home *** CD-ROM | disk | FTP | other *** search
/ Workbench Design / WB Collection.iso / workbench werkzeuge / icon tools / forceicon / source / ficonprefs.c < prev    next >
C/C++ Source or Header  |  1996-04-07  |  98KB  |  3,782 lines

  1. /*
  2. Auto:        smake FIconPrefs
  3. */
  4.  
  5.  
  6. /* $Revision Header built automatically *************** (do not edit) ************
  7. **
  8. ** © Copyright by GuntherSoft
  9. **
  10. ** File             : SnakeSYS:CPrgs/ForceIcon2/FIconPrefs.c
  11. ** Created on       : Wednesday, 16.03.94 16:19:51
  12. ** Created by       : Kai Iske
  13. ** Current revision : V1.0
  14. **
  15. **
  16. ** Purpose
  17. ** -------
  18. **   - Prefs Editor for ForceIcon
  19. **
  20. ** Revision V1.0
  21. ** --------------
  22. ** created on Wednesday, 16.03.94 16:19:51  by  Kai Iske.   LogMessage :
  23. **     --- Initial release ---
  24. **
  25. *********************************************************************************/
  26.  
  27.  
  28.  
  29.  
  30. /**********************************************************************/
  31. /*                     Define for DisplayError()                      */
  32. /**********************************************************************/
  33. #define    PREFSRUN
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40. /**********************************************************************/
  41. /*                      Routines for this module                      */
  42. /**********************************************************************/
  43. static BOOL            OpenAll(void);
  44. static void            CloseAll(void);
  45. static struct    FIconSema    *FindFIconSema(void);
  46. static void            RemoveFIconSema(struct FIconSema *FIconSema);
  47. static BOOL            InitApp(void);
  48. static void            RemoveApp(void);
  49. static ULONG    __saveds __asm    DispViewFunc(register __a0 struct Hook *MyHook, register __a2 char **array, register __a1 struct VolEntry *Data);
  50. static ULONG    __saveds __asm    DisableFunc(register __a0 struct Hook *MyHook, register __a2 APTR Obj, register __a1 APTR *Data);
  51. static ULONG    __saveds __asm    PageChangeFunc(register __a0 struct Hook *MyHook, register __a2 APTR Obj, register __a1 APTR *Data);
  52. static struct    VolEntry    *AddNewVolume(char *Name, ULONG Type, struct VolEntry *CopyPtr);
  53. static BOOL            CheckExists(struct List *CheckList, char *Name);
  54. static BOOL            SavePrefs(BOOL EnvMode, char *ToName);
  55. static void            DskChange(struct VolEntry *ListEntry);
  56. static BOOL            GetTaskList(struct List *AppList);
  57. static BOOL            GetFileName(struct Window *Window, char *Title, char *FileName, ULONG Flags1);
  58. static BOOL            CloneList(struct List *ToList, struct List *FromList);
  59.  
  60.  
  61.  
  62.  
  63.  
  64. /**********************************************************************/
  65. /*                    Functions of files included                     */
  66. /**********************************************************************/
  67.     // LoadPrefs.h
  68.  
  69. static BOOL            LoadPrefs(struct FIconSema *FIconSema, char *TryName);
  70.  
  71.     // VolList.h
  72.  
  73. static BOOL            GetDevVolList(struct List *VolList);
  74. static BOOL            GetDosEntries(struct List *VolList, ULONG Mode);
  75. static void            FreeDevVolList(struct List *VolList);
  76. static void            SortList(struct List *VolList, BOOL DisplayType);
  77. static void            SortPartialList(struct List *VolList, UWORD Left, UWORD Right);
  78. static APTR            GetListEntry(struct List *List, WORD EntryNum);
  79. static BOOL            MyStrCmp(char *FromName, char *ToName);
  80.  
  81.     // Error.h
  82.  
  83. static BOOL    __stdargs    DisplayError(LONG ErrCode, ULONG Arg1, ...);
  84.  
  85.     // CheckToolTypes.h
  86.  
  87. static void            CheckToolTypes(struct WBStartup *WBenchMsg);
  88.  
  89.     // PoolVec.h
  90.  
  91. static APTR            AllocVecPool(struct FIconSema *FIconSema, ULONG Size);
  92. static void            FreeVecPool(struct FIconSema *FIconSema, APTR Addr);
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99. /**********************************************************************/
  100. /*                           Library bases                            */
  101. /**********************************************************************/
  102. struct    ExecBase        *SysBase;
  103. struct    IntuitionBase        *IntuitionBase    = NULL;
  104. struct    DosLibrary        *DOSBase    = NULL;
  105. struct    GfxBase            *GfxBase    = NULL;
  106. struct    Library            *IconBase    = NULL;
  107. struct    Library            *UtilityBase    = NULL;
  108. struct    Library            *IFFParseBase    = NULL;
  109. struct    Library            *MUIMasterBase    = NULL;
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116. /**********************************************************************/
  117. /*                         "No-StartUp vars"                          */
  118. /**********************************************************************/
  119. #define    MUIVERS                    "$VER:ForceIcon_Prefs "REVISION" ("REVDATE")"
  120. char                _ProgramName[]    = "ForceIconPrefs";
  121. LONG                _OSERR        = 0;
  122.  
  123.  
  124.  
  125.  
  126. /**********************************************************************/
  127. /*                           Our variables                            */
  128. /**********************************************************************/
  129. static    struct    FIconSema    *FIconSema    = NULL;        // Pointer to our rendezvous semaphore
  130. static    struct    List        AvailableList;
  131. static    struct    List        AppAvailableList;
  132. static    struct    List        BackUpVolList;
  133. static    struct    List        BackUpAppList;
  134. static    UWORD            FlushMemory    = FALSE;
  135.  
  136.  
  137.  
  138.  
  139. /**********************************************************************/
  140. /*                 Application and window definitions                 */
  141. /**********************************************************************/
  142. static    struct    DiskObject    *DObj        = NULL;
  143. static    APTR            AppObject    = NULL;
  144. static    APTR            MainWindow    = NULL;
  145. static    APTR            UsedList;
  146. static    APTR            EditEntry;
  147. static    APTR            CopyEntry;
  148. static    APTR            RemoveEntry;
  149. static    APTR            AvailList;
  150. static    APTR            AddEntry;
  151. static    APTR            AddEntryMan;
  152. static    APTR            RescanList;
  153. static    APTR            AppUsedList;
  154. static    APTR            AppEditEntry;
  155. static    APTR            AppCopyEntry;
  156. static    APTR            AppRemoveEntry;
  157. static    APTR            AppAvailList;
  158. static    APTR            AppAddEntry;
  159. static    APTR            AppAddEntryMan;
  160. static    APTR            AppRescanList;
  161. static    APTR            SaveObj;
  162. static    APTR            UseObj;
  163. static    APTR            HideObj;
  164.  
  165. static    APTR            EditWindow;
  166. static    APTR            VolumeName;
  167. static    APTR            VolumeType;
  168. static    APTR            IconPosGroup;
  169. static    APTR            IconPos[2];
  170. static    APTR            IconX;
  171. static    APTR            IconY;
  172. static    APTR            Position;
  173. static    APTR            UseIconGroup;
  174. static    APTR            UseIcon[2];
  175. static    APTR            IconName;
  176. static    APTR            UseWindowGroup;
  177. static    APTR            UseWindow[2];
  178. static    APTR            WinX;
  179. static    APTR            WinY;
  180. static    APTR            WinWidth;
  181. static    APTR            WinHeight;
  182. static    APTR            LookWin;
  183. static    APTR            UseFlagsGroup;
  184. static    APTR            UseFlags[2];
  185. static    APTR            FlagModes;
  186. static    APTR            EditOkObj;
  187. static    APTR            EditCancelObj;
  188.  
  189. static    APTR            AppEditWindow;
  190. static    APTR            AppTaskName;
  191. static    APTR            AppIconPos;
  192. static    APTR            AppIconX;
  193. static    APTR            AppIconY;
  194. static    APTR            AppPosition;
  195. static    APTR            AppUseIcon;
  196. static    APTR            AppIconName;
  197. static    APTR            AppEditOkObj;
  198. static    APTR            AppEditCancelObj;
  199.  
  200. static    APTR            ManWindow;
  201. static    APTR            ManVolName;
  202. static    APTR            ManVolType;
  203. static    APTR            ManOkObj;
  204. static    APTR            ManCancelObj;
  205.  
  206. static    APTR            AppManWindow;
  207. static    APTR            AppManTaskName;
  208. static    APTR            AppManOkObj;
  209. static    APTR            AppManCancelObj;
  210.  
  211.  
  212.  
  213.  
  214.  
  215. /**********************************************************************/
  216. /*                            Page titles                             */
  217. /**********************************************************************/
  218. static const char *MainWinPageTitles[] =
  219. {
  220.     "Volumes/Devices",
  221.     "AppIcons",
  222.     NULL
  223. };
  224.  
  225.  
  226. /**********************************************************************/
  227. /*                     Strings for Cycle gadgets                      */
  228. /**********************************************************************/
  229. static const char *TypeEntries[] =
  230. {
  231.     "Volume",
  232.     "Device",
  233.     NULL
  234. };
  235.  
  236.  
  237. static const char *ModeEntriesVol[] =
  238. {
  239.     "Ignore",
  240.     "Use",
  241.     "Inherit",
  242.     NULL
  243. };
  244.  
  245.  
  246. static const char *ModeEntriesDev[] =
  247. {
  248.     "Ignore",
  249.     "Use",
  250.     NULL
  251. };
  252.  
  253.  
  254. static const char *PositionEntries[] =
  255. {
  256.     "Open position window",
  257.     "Close position window",
  258.     NULL
  259. };
  260.  
  261.  
  262.  
  263. static const char *LookWinEntries[] =
  264. {
  265.     "Open window",
  266.     "Close window",
  267.     NULL
  268. };
  269.  
  270.  
  271. static const char *FlagModesEntries[] =
  272. {
  273.     "only icons + view by icon",
  274.     "only icons + view by name",
  275.     "only icons + view by date",
  276.     "only icons + view by size",
  277.     "all files + view by icon",
  278.     "all files + view by name",
  279.     "all files + view by date",
  280.     "all files + view by size",
  281.     NULL
  282. };
  283.  
  284.  
  285.  
  286.  
  287. /**********************************************************************/
  288. /*                          Menu definition                           */
  289. /**********************************************************************/
  290. static struct    NewMenu MainMenuDef[] =
  291. {
  292.     NM_TITLE, "Project", NULL, 0, NULL, NULL,
  293.     NM_ITEM, "Open...", "O", 0, NULL, (APTR)ID_OPEN,
  294.     NM_ITEM, "Save as...", "A", 0, NULL, (APTR)ID_SAVEAS,
  295.     NM_ITEM, NM_BARLABEL, NULL, 0, NULL, NULL,
  296.     NM_ITEM, "About", "?", 0, NULL, (APTR)ID_ABOUT,
  297.     NM_ITEM, NM_BARLABEL, NULL, 0, NULL, NULL,
  298.     NM_ITEM, "Quit (Prefs + Server)", "Q", 0, NULL, (APTR)ID_QUIT,
  299.     NM_ITEM, "Quit (Prefs)", "H", 0, NULL, (APTR)ID_HIDE,
  300.  
  301.     NM_TITLE, "Settings", NULL, 0, NULL, NULL,
  302.     NM_ITEM, "Reset to defaults", "D", 0, NULL, (APTR)ID_RESET,
  303.     NM_ITEM, "Last saved", "L", 0, NULL, (APTR)ID_LASTSAVED,
  304.     NM_ITEM, "Restore", "R", 0, NULL, (APTR)ID_RESTORE,
  305.  
  306.     NM_END, NULL, NULL, 0, NULL, NULL
  307. };
  308.  
  309. /**********************************************************************/
  310. /*                            Display Hook                            */
  311. /**********************************************************************/
  312. static struct Hook    DispViewHook =
  313. {
  314.     {NULL},
  315.     (APTR)DispViewFunc,
  316.     NULL,
  317.     NULL
  318. };
  319.  
  320.  
  321.  
  322. static struct Hook    DisableHook =
  323. {
  324.     {NULL},
  325.     (APTR)DisableFunc,
  326.     NULL,
  327.     NULL
  328. };
  329.  
  330.  
  331.  
  332. static struct Hook    PageChangeHook =
  333. {
  334.     {NULL},
  335.     (APTR)PageChangeFunc,
  336.     NULL,
  337.     NULL
  338. };
  339.  
  340.  
  341.  
  342. /**********************************************************************/
  343. /*                      This is our main program                      */
  344. /**********************************************************************/
  345. ULONG __saveds main(void)
  346. {
  347.     struct    Process        *MyProc;
  348.     struct    WBStartup    *WBenchMsg    = NULL;
  349.     struct    VolEntry    *EditEntryPtr    = NULL;
  350.     struct    Window        *PosWindow    = NULL,
  351.                 *DrawerWindow    = NULL;
  352.     ULONG            MySig,
  353.                 ReturnID;
  354.     BOOL            GoOn        = TRUE;
  355.  
  356.  
  357.  
  358.  
  359.         // Get SysBase
  360.  
  361.     SysBase    = *((struct ExecBase **)0x4L);
  362.  
  363.  
  364.         // Get address of our process
  365.  
  366.     MyProc = (struct Process *)FindTask(NULL);
  367.  
  368.  
  369.  
  370.         // Determine where we were started from
  371.  
  372.     if(!MyProc->pr_CLI)
  373.     {
  374.         WaitPort(&MyProc->pr_MsgPort);
  375.         WBenchMsg = (struct WBStartup *)GetMsg(&MyProc->pr_MsgPort);
  376.     }
  377.  
  378.  
  379.  
  380.         // Don`t run under OS < 37
  381.  
  382.     if(((struct Library *)SysBase)->lib_Version >= 37)
  383.     {
  384.             // Open libraries
  385.  
  386.         if(OpenAll())
  387.         {
  388.                 // Try to find Semaphore
  389.  
  390.             if((FIconSema = FindFIconSema()))
  391.             {
  392.                     // Old version with no AppIcon support running?
  393.  
  394.                 if(!FIconSema->FIconSema.ss_Link.ln_Pri)
  395.                 {
  396.                     struct    Task    *ServerTask    = FIconSema->ServerTask;
  397.  
  398.                         // Server task found?
  399.  
  400.                     if(ServerTask)
  401.                     {
  402.                             // Release semaphore
  403.  
  404.                         RemoveFIconSema(FIconSema);
  405.  
  406.                             // Break server program
  407.  
  408.                         Signal(ServerTask, SIGBREAKF_CTRL_C);
  409.  
  410.                             // Display error
  411.  
  412.                         DisplayError(ERR_OLDFICON, NULL);
  413.  
  414.                             // Create new semaphore
  415.  
  416.                         FIconSema    = FindFIconSema();
  417.                     }
  418.                 }
  419.             }
  420.  
  421.             if(FIconSema)
  422.             {
  423.  
  424.                     // Check for ToolTypes/commandline options
  425.  
  426.                 CheckToolTypes(WBenchMsg);
  427.  
  428.                     // Create backups of settings
  429.  
  430.                 NewList(&BackUpVolList);
  431.                 NewList(&BackUpAppList);
  432.  
  433.  
  434.                 if(InitApp() && CloneList(&BackUpVolList, &FIconSema->VolumeList) && CloneList(&BackUpAppList, &FIconSema->AppIconList))
  435.                 {
  436.                     while(GoOn)
  437.                     {
  438.                         switch(ReturnID = DoMethod(AppObject, MUIM_Application_Input, &MySig))
  439.                         {
  440.                                 // Handle MAINWINDOW
  441.  
  442.  
  443.                                 // Save ?!?!
  444.  
  445.                             case ID_SAVE :
  446.                             {
  447.                                 SavePrefs(FALSE, NULL);
  448.                                 GoOn    = FALSE;
  449.                                 break;
  450.                             }
  451.  
  452.                                 // Use ?!?!
  453.  
  454.                             case ID_USE :
  455.                             {
  456.                                 SavePrefs(TRUE, NULL);
  457.                                 GoOn    = FALSE;
  458.                                 break;
  459.                             }
  460.  
  461.                                 // About ???
  462.  
  463.                             case ID_ABOUT :
  464.                             {
  465.                                 DisplayError(ERR_ABOUT, VERNUM, REVNUM, REVDATE, NULL);
  466.                                 break;
  467.                             }
  468.  
  469.                                 // Hide/Quit Prefs ?!?
  470.  
  471.                             case ID_HIDE :
  472.                             {
  473.                                 GoOn    = FALSE;
  474.                                 break;
  475.                             }
  476.  
  477.                                 // Hide/Quit Prefs and server ???
  478.  
  479.                             case ID_QUIT :
  480.                             {
  481.                                 struct    Task    *ServerTask;
  482.  
  483.                                 ObtainSemaphore(&FIconSema->FIconSema);
  484.                                 Forbid();
  485.                                 ServerTask    = FIconSema->ServerTask;
  486.                                 ReleaseSemaphore(&FIconSema->FIconSema);
  487.  
  488.                                     // Tell server to go away
  489.  
  490.                                 if(ServerTask)
  491.                                     Signal(ServerTask, SIGBREAKF_CTRL_C);
  492.                                 Permit();
  493.  
  494.                                 GoOn    = FALSE;
  495.                                 break;
  496.                             }
  497.  
  498.                                 // Load prefs?
  499.  
  500.                             case ID_OPEN :
  501.                             {
  502.                                 struct    Window    *Window;
  503.                                 char        FileName[514];
  504.  
  505.                                     // Create standard filename
  506.  
  507.                                 strcpy(FileName, "ENV:ForceIcon_prefs.iff");
  508.  
  509.                                     // Get pointer to main window
  510.  
  511.                                 get(MainWindow, MUIA_Window_Window, &Window);
  512.                                 if(GetFileName(Window, "Select settings to load...", FileName, 0))
  513.                                 {
  514.                                         // Clear old lists
  515.  
  516.                                     FreeDevVolList(&FIconSema->VolumeList);
  517.                                     FreeDevVolList(&FIconSema->AppIconList);
  518.                                     DoMethod(UsedList, MUIM_List_Clear, NULL);
  519.                                     DoMethod(AppUsedList, MUIM_List_Clear, NULL);
  520.  
  521.                                     if(LoadPrefs(FIconSema, FileName))
  522.                                     {
  523.                                         struct    VolEntry    *ThisEntry;
  524.  
  525.                                             // Add list of used entries
  526.  
  527.                                         ObtainSemaphore(&FIconSema->FIconSema);
  528.                                         ThisEntry    = (struct VolEntry *)FIconSema->VolumeList.lh_Head;
  529.  
  530.                                         while(ThisEntry->Link.ln_Succ)
  531.                                         {
  532.                                             DoMethod(UsedList, MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  533.  
  534.                                             ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  535.                                         }
  536.                                         ReleaseSemaphore(&FIconSema->FIconSema);
  537.  
  538.  
  539.                                         ObtainSemaphore(&FIconSema->FIconSema);
  540.                                         ThisEntry    = (struct VolEntry *)FIconSema->AppIconList.lh_Head;
  541.  
  542.                                         while(ThisEntry->Link.ln_Succ)
  543.                                         {
  544.                                             DoMethod(AppUsedList, MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  545.  
  546.                                             ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  547.                                         }
  548.                                         ReleaseSemaphore(&FIconSema->FIconSema);
  549.                                     }
  550.                                 }
  551.                                 break;
  552.                             }
  553.  
  554.                             case ID_SAVEAS :
  555.                             {
  556.                                 struct    Window    *Window;
  557.                                 char        FileName[514];
  558.  
  559.                                     // Create standard filename
  560.  
  561.                                 strcpy(FileName, "ENVARC:ForceIcon_prefs.iff");
  562.  
  563.                                     // Get pointer to main window
  564.  
  565.                                 get(MainWindow, MUIA_Window_Window, &Window);
  566.                                 if(GetFileName(Window, "Select file to save to...", FileName, 0))
  567.                                     SavePrefs(FALSE, FileName);
  568.                                 break;
  569.                             }
  570.  
  571.                             case ID_RESET :
  572.                             {
  573.                                 FreeDevVolList(&FIconSema->VolumeList);
  574.                                 FreeDevVolList(&FIconSema->AppIconList);
  575.                                 DoMethod(UsedList, MUIM_List_Clear, NULL);
  576.                                 DoMethod(AppUsedList, MUIM_List_Clear, NULL);
  577.                                 break;
  578.                             }
  579.  
  580.                             case ID_LASTSAVED :
  581.                             {
  582.                                 FreeDevVolList(&FIconSema->VolumeList);
  583.                                 FreeDevVolList(&FIconSema->AppIconList);
  584.                                 DoMethod(UsedList, MUIM_List_Clear, NULL);
  585.                                 DoMethod(AppUsedList, MUIM_List_Clear, NULL);
  586.  
  587.                                 if(LoadPrefs(FIconSema, NULL))
  588.                                 {
  589.                                     struct    VolEntry    *ThisEntry;
  590.  
  591.                                         // Add list of used entries
  592.  
  593.                                     ObtainSemaphore(&FIconSema->FIconSema);
  594.                                     ThisEntry    = (struct VolEntry *)FIconSema->VolumeList.lh_Head;
  595.  
  596.                                     while(ThisEntry->Link.ln_Succ)
  597.                                     {
  598.                                         DoMethod(UsedList, MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  599.  
  600.                                         ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  601.                                     }
  602.                                     ReleaseSemaphore(&FIconSema->FIconSema);
  603.  
  604.  
  605.                                     ObtainSemaphore(&FIconSema->FIconSema);
  606.                                     ThisEntry    = (struct VolEntry *)FIconSema->AppIconList.lh_Head;
  607.  
  608.                                     while(ThisEntry->Link.ln_Succ)
  609.                                     {
  610.                                         DoMethod(AppUsedList, MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  611.  
  612.                                         ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  613.                                     }
  614.                                     ReleaseSemaphore(&FIconSema->FIconSema);
  615.                                 }
  616.                                 break;
  617.                             }
  618.  
  619.                             case ID_RESTORE :
  620.                             {
  621.                                 struct    VolEntry    *ThisEntry;
  622.  
  623.                                 FreeDevVolList(&FIconSema->VolumeList);
  624.                                 FreeDevVolList(&FIconSema->AppIconList);
  625.                                 DoMethod(UsedList, MUIM_List_Clear, NULL);
  626.                                 DoMethod(AppUsedList, MUIM_List_Clear, NULL);
  627.  
  628.                                 if(CloneList(&FIconSema->VolumeList, &BackUpVolList) && CloneList(&FIconSema->AppIconList, &BackUpAppList))
  629.                                 {
  630.                                         // Add list of used entries
  631.  
  632.                                     ObtainSemaphore(&FIconSema->FIconSema);
  633.                                     ThisEntry    = (struct VolEntry *)FIconSema->VolumeList.lh_Head;
  634.  
  635.                                     while(ThisEntry->Link.ln_Succ)
  636.                                     {
  637.                                         DoMethod(UsedList, MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  638.  
  639.                                         ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  640.                                     }
  641.                                     ReleaseSemaphore(&FIconSema->FIconSema);
  642.  
  643.  
  644.                                     ObtainSemaphore(&FIconSema->FIconSema);
  645.                                     ThisEntry    = (struct VolEntry *)FIconSema->AppIconList.lh_Head;
  646.  
  647.                                     while(ThisEntry->Link.ln_Succ)
  648.                                     {
  649.                                         DoMethod(AppUsedList, MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  650.  
  651.                                         ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  652.                                     }
  653.                                     ReleaseSemaphore(&FIconSema->FIconSema);
  654.                                 }
  655.                             }
  656.  
  657.  
  658.                                 // Edit entry (Volumes)???
  659.  
  660.                             case ID_USEDLIST :
  661.                             case ID_EDITENTRY :
  662.                             {
  663.                                 struct    VolEntry    *ThisEntry;
  664.  
  665.                                 DoMethod(UsedList, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &ThisEntry);
  666.  
  667.                                 if(ThisEntry)
  668.                                 {
  669.                                     set(VolumeName, MUIA_String_Contents, ThisEntry->VolName);
  670.                                     set(VolumeType, MUIA_Cycle_Active, (ThisEntry->Link.ln_Type == LDF_DEVICES));
  671.                                     set(IconPos[0], MUIA_Cycle_Active, ThisEntry->IconPos);
  672.                                     set(IconPos[1], MUIA_Cycle_Active, ThisEntry->IconPos);
  673.                                     set(IconX, MUIA_String_Integer, ThisEntry->Left);
  674.                                     set(IconX, MUIA_Disabled, (ThisEntry->IconPos != MODE_USE));
  675.                                     set(IconY, MUIA_String_Integer, ThisEntry->Top);
  676.                                     set(IconY, MUIA_Disabled, (ThisEntry->IconPos != MODE_USE));
  677.                                     set(Position, MUIA_Cycle_Active, 0);
  678.                                     set(Position, MUIA_Disabled, (ThisEntry->IconPos != MODE_USE));
  679.                                     set(UseIcon[0], MUIA_Cycle_Active, ThisEntry->UseAlt);
  680.                                     set(UseIcon[1], MUIA_Cycle_Active, ThisEntry->UseAlt);
  681.                                     set(IconName, MUIA_String_Contents, ThisEntry->IconName);
  682.                                     set(IconName, MUIA_Disabled, (ThisEntry->UseAlt != MODE_USE));
  683.                                     set(UseWindow[0], MUIA_Cycle_Active, ThisEntry->UseWin);
  684.                                     set(UseWindow[1], MUIA_Cycle_Active, ThisEntry->UseWin);
  685.                                     set(WinX, MUIA_String_Integer, ThisEntry->WinX);
  686.                                     set(WinX, MUIA_Disabled, (ThisEntry->UseWin != MODE_USE));
  687.                                     set(WinY, MUIA_String_Integer, ThisEntry->WinY);
  688.                                     set(WinY, MUIA_Disabled, (ThisEntry->UseWin != MODE_USE));
  689.                                     set(WinWidth, MUIA_String_Integer, ThisEntry->WinWidth);
  690.                                     set(WinWidth, MUIA_Disabled, (ThisEntry->UseWin != MODE_USE));
  691.                                     set(WinHeight, MUIA_String_Integer, ThisEntry->WinHeight);
  692.                                     set(WinHeight, MUIA_Disabled, (ThisEntry->UseWin != MODE_USE));
  693.                                     set(LookWin, MUIA_Cycle_Active, 0);
  694.                                     set(LookWin, MUIA_Disabled, (ThisEntry->UseWin != MODE_USE));
  695.                                     set(UseFlags[0], MUIA_Cycle_Active, ThisEntry->UseFlags);
  696.                                     set(UseFlags[1], MUIA_Cycle_Active, ThisEntry->UseFlags);
  697.                                     set(FlagModes, MUIA_Cycle_Active, ThisEntry->WinFlags);
  698.                                     set(FlagModes, MUIA_Disabled, (ThisEntry->UseFlags != MODE_USE));
  699.  
  700.                                     set(MainWindow, MUIA_Window_Sleep, TRUE);
  701.  
  702.                                     set(EditWindow, MUIA_Window_Open, TRUE);
  703.  
  704.                                     EditEntryPtr    = ThisEntry;
  705.                                 }
  706.                                 break;
  707.                             }
  708.  
  709.                                 // Edit entry (AppIcons)???
  710.  
  711.                             case ID_APPUSEDLIST :
  712.                             case ID_APPEDITENTRY :
  713.                             {
  714.                                 struct    VolEntry    *ThisEntry;
  715.  
  716.                                 DoMethod(AppUsedList, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &ThisEntry);
  717.  
  718.                                 if(ThisEntry)
  719.                                 {
  720.                                     set(AppTaskName, MUIA_String_Contents, ThisEntry->VolName);
  721.                                     set(AppIconPos, MUIA_Cycle_Active, ThisEntry->IconPos);
  722.                                     set(AppIconX, MUIA_String_Integer, ThisEntry->Left);
  723.                                     set(AppIconX, MUIA_Disabled, (ThisEntry->IconPos != MODE_USE));
  724.                                     set(AppIconY, MUIA_String_Integer, ThisEntry->Top);
  725.                                     set(AppIconY, MUIA_Disabled, (ThisEntry->IconPos != MODE_USE));
  726.                                     set(AppPosition, MUIA_Cycle_Active, 0);
  727.                                     set(AppPosition, MUIA_Disabled, (ThisEntry->IconPos != MODE_USE));
  728.                                     set(AppUseIcon, MUIA_Cycle_Active, ThisEntry->UseAlt);
  729.                                     set(AppIconName, MUIA_String_Contents, ThisEntry->IconName);
  730.                                     set(AppIconName, MUIA_Disabled, (ThisEntry->UseAlt != MODE_USE));
  731.  
  732.                                     set(MainWindow, MUIA_Window_Sleep, TRUE);
  733.  
  734.                                     set(AppEditWindow, MUIA_Window_Open, TRUE);
  735.  
  736.                                     EditEntryPtr    = ThisEntry;
  737.                                 }
  738.                                 break;
  739.                             }
  740.  
  741.                                 // Copy an entry (Volumes)???
  742.  
  743.                             case ID_COPYENTRY :
  744.                             {
  745.                                 struct    VolEntry    *ThisEntry;
  746.  
  747.  
  748.                                 DoMethod(UsedList, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &ThisEntry);
  749.  
  750.                                 if(ThisEntry)
  751.                                 {
  752.                                     set(ManVolName, MUIA_String_Contents, ThisEntry->VolName);
  753.                                     set(ManVolType, MUIA_Cycle_Active, (ThisEntry->Link.ln_Type == LDF_DEVICES));
  754.  
  755.                                     set(MainWindow, MUIA_Window_Sleep, TRUE);
  756.                                     set(ManWindow, MUIA_Window_Title, "Copy entry");
  757.                                     set(ManWindow, MUIA_Window_Open, TRUE);
  758.  
  759.                                     EditEntryPtr    = ThisEntry;
  760.                                 }
  761.                                 break;
  762.                             }
  763.  
  764.                                 // Copy an entry (AppIcons)???
  765.  
  766.                             case ID_APPCOPYENTRY :
  767.                             {
  768.                                 struct    VolEntry    *ThisEntry;
  769.  
  770.  
  771.                                 DoMethod(AppUsedList, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &ThisEntry);
  772.  
  773.                                 if(ThisEntry)
  774.                                 {
  775.                                     set(AppManTaskName, MUIA_String_Contents, ThisEntry->VolName);
  776.  
  777.                                     set(MainWindow, MUIA_Window_Sleep, TRUE);
  778.                                     set(AppManWindow, MUIA_Window_Title, "Copy entry");
  779.                                     set(AppManWindow, MUIA_Window_Open, TRUE);
  780.  
  781.                                     EditEntryPtr    = ThisEntry;
  782.                                 }
  783.                                 break;
  784.                             }
  785.  
  786.  
  787.                                 // Remove an entry (Volumes)???
  788.  
  789.                             case ID_REMOVEENTRY :
  790.                             {
  791.                                 struct    VolEntry    *ThisEntry;
  792.  
  793.                                 DoMethod(UsedList, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &ThisEntry);
  794.  
  795.                                 if(ThisEntry)
  796.                                 {
  797.                                     ObtainSemaphore(&FIconSema->FIconSema);
  798.  
  799.                                         // Remove entry from listview
  800.  
  801.                                     DoMethod(UsedList, MUIM_List_Remove, MUIV_List_Remove_Active);
  802.  
  803.                                         // Remove entry from internal list
  804.  
  805.                                     Remove(ThisEntry);
  806.                                     FreeVecPool(FIconSema, ThisEntry);
  807.  
  808.                                     FIconSema->VolumeList.lh_Type--;
  809.  
  810.                                     ReleaseSemaphore(&FIconSema->FIconSema);
  811.                                 }
  812.                                 break;
  813.                             }
  814.  
  815.                                 // Remove an entry (AppIcons)???
  816.  
  817.                             case ID_APPREMOVEENTRY :
  818.                             {
  819.                                 struct    VolEntry    *ThisEntry;
  820.  
  821.                                 DoMethod(AppUsedList, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &ThisEntry);
  822.  
  823.                                 if(ThisEntry)
  824.                                 {
  825.                                     ObtainSemaphore(&FIconSema->FIconSema);
  826.  
  827.                                         // Remove entry from listview
  828.  
  829.                                     DoMethod(AppUsedList, MUIM_List_Remove, MUIV_List_Remove_Active);
  830.  
  831.                                         // Remove entry from internal list
  832.  
  833.                                     Remove(ThisEntry);
  834.                                     FreeVecPool(FIconSema, ThisEntry);
  835.  
  836.                                     FIconSema->AppIconList.lh_Type--;
  837.  
  838.                                     ReleaseSemaphore(&FIconSema->FIconSema);
  839.                                 }
  840.                                 break;
  841.                             }
  842.  
  843.                                 // Add an entry (Volumes) ???
  844.  
  845.                             case ID_AVAILLIST :
  846.                             case ID_ADDENTRY :
  847.                             {
  848.                                 struct    VolEntry    *ThisEntry;
  849.  
  850.                                     // Really get entry ???
  851.  
  852.                                 DoMethod(AvailList, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &ThisEntry);
  853.  
  854.                                 if(ThisEntry)
  855.                                     AddNewVolume(ThisEntry->VolName, ThisEntry->Link.ln_Type, NULL);
  856.                                 break;
  857.                             }
  858.  
  859.  
  860.                                 // Add an entry (AppIcon) ???
  861.  
  862.                             case ID_APPAVAILLIST :
  863.                             case ID_APPADDENTRY :
  864.                             {
  865.                                 struct    VolEntry    *ThisEntry;
  866.  
  867.                                     // Really get entry ???
  868.  
  869.                                 DoMethod(AppAvailList, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &ThisEntry);
  870.  
  871.                                 if(ThisEntry)
  872.                                     AddNewVolume(ThisEntry->VolName, FICON_APPICON, NULL);
  873.                                 break;
  874.                             }
  875.  
  876.  
  877.                                 // Manually add an entry (Volumes)???
  878.  
  879.                             case ID_ADDENTRYMAN :
  880.                             {
  881.                                 set(ManVolName, MUIA_String_Contents, "");
  882.                                 set(ManVolType, MUIA_Cycle_Active, 0);
  883.  
  884.                                 set(MainWindow, MUIA_Window_Sleep, TRUE);
  885.                                 set(ManWindow, MUIA_Window_Title, "Add manually");
  886.                                 set(ManWindow, MUIA_Window_Open, TRUE);
  887.  
  888.                                 EditEntryPtr    = NULL;
  889.                                 break;
  890.                             }
  891.  
  892.  
  893.                                 // Manually add an entry (AppIcons)???
  894.  
  895.                             case ID_APPADDENTRYMAN :
  896.                             {
  897.                                 set(AppManTaskName, MUIA_String_Contents, "");
  898.  
  899.                                 set(MainWindow, MUIA_Window_Sleep, TRUE);
  900.                                 set(AppManWindow, MUIA_Window_Title, "Add manually");
  901.                                 set(AppManWindow, MUIA_Window_Open, TRUE);
  902.  
  903.                                 EditEntryPtr    = NULL;
  904.                                 break;
  905.                             }
  906.  
  907.  
  908.                                 // Rescan list (Volumes)???
  909.  
  910.                             case ID_RESCANLIST :
  911.                             {
  912.                                 struct    VolEntry    *ThisEntry;
  913.  
  914.  
  915.                                     // Remove List from listview
  916.  
  917.                                 DoMethod(AvailList, MUIM_List_Clear, NULL);
  918.  
  919.                                     // FreeList
  920.  
  921.                                 FreeDevVolList(&AvailableList);
  922.                                 GetDevVolList(&AvailableList);
  923.  
  924.                                     // Add list of available entries
  925.  
  926.                                 ThisEntry    = (struct VolEntry *)AvailableList.lh_Head;
  927.                                 while(ThisEntry->Link.ln_Succ)
  928.                                 {
  929.                                     DoMethod(AvailList, MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  930.  
  931.                                     ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  932.                                 }
  933.                                 break;
  934.                             }
  935.  
  936.  
  937.                                 // Rescan list (AppIcons)???
  938.  
  939.                             case ID_APPRESCANLIST :
  940.                             {
  941.                                 struct    VolEntry    *ThisEntry;
  942.  
  943.  
  944.                                     // Remove List from listview
  945.  
  946.                                 DoMethod(AppAvailList, MUIM_List_Clear, NULL);
  947.  
  948.                                     // FreeList
  949.  
  950.                                 FreeDevVolList(&AppAvailableList);
  951.                                 GetTaskList(&AppAvailableList);
  952.  
  953.                                     // Add list of available entries
  954.  
  955.                                 ThisEntry    = (struct VolEntry *)AppAvailableList.lh_Head;
  956.                                 while(ThisEntry->Link.ln_Succ)
  957.                                 {
  958.                                     DoMethod(AppAvailList, MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  959.  
  960.                                     ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  961.                                 }
  962.                                 break;
  963.                             }
  964.  
  965.  
  966.  
  967.                                 // Check Edit window
  968.  
  969.  
  970.                                 // New input from IconX/Y gadgets?
  971.  
  972.                             case ID_ICONX :
  973.                             case ID_ICONY :
  974.                             case ID_APPICONX :
  975.                             case ID_APPICONY :
  976.                             {
  977.                                 LONG    PosX,
  978.                                     PosY;
  979.  
  980.  
  981.                                     // Only do, when PosWindow is open, as values
  982.                                     // will be obtained on exit, anyway
  983.  
  984.                                 if(PosWindow)
  985.                                 {
  986.                                     get((ReturnID == ID_ICONX || ReturnID == ID_ICONY) ? IconX : AppIconX, MUIA_String_Integer, &PosX);
  987.                                     get((ReturnID == ID_ICONX || ReturnID == ID_ICONY) ? IconY : AppIconY, MUIA_String_Integer, &PosY);
  988.  
  989.                                     ChangeWindowBox(PosWindow, (PosX < 0 ? PosWindow->WScreen->Width + PosX : PosX), (PosY < 0 ? PosWindow->WScreen->Height + PosY : PosY), PosWindow->Width, PosWindow->Height);
  990.                                 }
  991.                                 break;
  992.                             }
  993.  
  994.                                 // New input from Drawer Windows?
  995.  
  996.                             case ID_WINX :
  997.                             case ID_WINY :
  998.                             case ID_WINWIDTH :
  999.                             case ID_WINHEIGHT :
  1000.                             {
  1001.                                 ULONG    Left,
  1002.                                     Top,
  1003.                                     Width,
  1004.                                     Height;
  1005.  
  1006.                                 if(DrawerWindow)
  1007.                                 {
  1008.                                     get(WinX, MUIA_String_Integer, &Left);
  1009.                                     get(WinY, MUIA_String_Integer, &Top);
  1010.                                     get(WinWidth, MUIA_String_Integer, &Width);
  1011.                                     get(WinHeight, MUIA_String_Integer, &Height);
  1012.  
  1013.                                     ChangeWindowBox(DrawerWindow, Left, Top, Width, Height);
  1014.                                 }
  1015.                                 break;
  1016.                             }
  1017.  
  1018.  
  1019.                                 // Open/Close position window ???
  1020.  
  1021.                             case ID_POSITION :
  1022.                             case ID_APPPOSITION :
  1023.                             {
  1024.                                 ULONG    State;
  1025.  
  1026.                                 get((ReturnID == ID_POSITION ? Position : AppPosition), MUIA_Cycle_Active, &State);
  1027.  
  1028.                                 if(State && !PosWindow && EditEntryPtr)
  1029.                                 {
  1030.                                     struct    Screen    *WBScreen;
  1031.                                     LONG        Left,
  1032.                                             Top;
  1033.  
  1034.                                     get((ReturnID == ID_POSITION ? IconX : AppIconY), MUIA_String_Integer, &Left);
  1035.                                     get((ReturnID == ID_POSITION ? IconY : AppIconY), MUIA_String_Integer, &Top);
  1036.  
  1037.                                     if((WBScreen = LockPubScreen(NULL)))
  1038.                                     {
  1039.                                         PosWindow = OpenWindowTags(NULL,
  1040.                                                 WA_Left,    (Left < 0 ? WBScreen->Width + Left : Left),
  1041.                                                 WA_Top,        (Top < 0 ? WBScreen->Height + Top : Top),
  1042.                                                 WA_Width,    (WBScreen->BarLayer->rp->Font->tf_XSize * 4) + 2 + WBScreen->WBorLeft + WBScreen->WBorRight,
  1043.                                                 WA_Height,    WBScreen->WBorTop + WBScreen->Font->ta_YSize + 1,
  1044.                                                 WA_IDCMP,    IDCMP_CHANGEWINDOW,
  1045.                                                 WA_Flags,    WFLG_DRAGBAR|WFLG_RMBTRAP,
  1046.                                                 WA_Title,    "Icon",
  1047.                                                 WA_PubScreen,    WBScreen,
  1048.                                         TAG_DONE);
  1049.  
  1050.                                         UnlockPubScreen(NULL, WBScreen);
  1051.  
  1052.                                         if(!PosWindow)
  1053.                                         {
  1054.                                             set((ReturnID == ID_POSITION ? Position : AppPosition), MUIA_Cycle_Active, 0);
  1055.                                             DisplayError(ERR_NOMEM, NULL);
  1056.                                         }
  1057.                                     }
  1058.                                 }
  1059.                                 else if(PosWindow)
  1060.                                 {
  1061.                                     CloseWindow(PosWindow);
  1062.                                     PosWindow    = NULL;
  1063.                                 }
  1064.                                 break;
  1065.                             }
  1066.  
  1067.                                 // Open/Close Drawer Window ???
  1068.  
  1069.                             case ID_DRAWER :
  1070.                             {
  1071.                                 ULONG    State;
  1072.  
  1073.                                 get(LookWin, MUIA_Cycle_Active, &State);
  1074.  
  1075.                                 if(State && !DrawerWindow && EditEntryPtr)
  1076.                                 {
  1077.                                     struct    Screen    *WBScreen;
  1078.                                     ULONG        Left,
  1079.                                             Top,
  1080.                                             Width,
  1081.                                             Height;
  1082.  
  1083.  
  1084.                                     get(WinX, MUIA_String_Integer, &Left);
  1085.                                     get(WinY, MUIA_String_Integer, &Top);
  1086.                                     get(WinWidth, MUIA_String_Integer, &Width);
  1087.                                     get(WinHeight, MUIA_String_Integer, &Height);
  1088.  
  1089.                                     if((WBScreen = LockPubScreen(NULL)))
  1090.                                     {
  1091.                                         DrawerWindow = OpenWindowTags(NULL,
  1092.                                                 WA_Left,    Left,
  1093.                                                 WA_Top,        Top,
  1094.                                                 WA_Width,    (Width ? Width: 50),
  1095.                                                 WA_Height,    (Height ? Height : 50),
  1096.                                                 WA_MaxWidth,    -1,
  1097.                                                 WA_MaxHeight,    -1,
  1098.                                                 WA_IDCMP,    IDCMP_CHANGEWINDOW,
  1099.                                                 WA_Flags,    WFLG_DEPTHGADGET|WFLG_DRAGBAR|WFLG_RMBTRAP|WFLG_SIZEBRIGHT|WFLG_SIZEBBOTTOM,
  1100.                                                 WA_Title,    "Drawer window (demo)",
  1101.                                                 WA_PubScreen,    WBScreen,
  1102.                                                 WA_SizeGadget,    TRUE,
  1103.                                         TAG_DONE);
  1104.  
  1105.                                         UnlockPubScreen(NULL, WBScreen);
  1106.                                         
  1107.                                         if(!DrawerWindow)
  1108.                                         {
  1109.                                             set(LookWin, MUIA_Cycle_Active, 0);
  1110.                                             DisplayError(ERR_NOMEM, NULL);
  1111.                                         }
  1112.                                     }
  1113.                                 }
  1114.                                 else if(DrawerWindow)
  1115.                                 {
  1116.                                     CloseWindow(DrawerWindow);
  1117.                                     DrawerWindow    = NULL;
  1118.                                 }
  1119.                                 break;
  1120.                             }
  1121.  
  1122.                                 // Ok (Volumes)???
  1123.  
  1124.                             case ID_EDITOK :
  1125.                             {
  1126.                                 ULONG    OldType,
  1127.                                     NewName,
  1128.                                     PopAslState;
  1129.                                 BOOL    DoSort    = FALSE;
  1130.  
  1131.  
  1132.                                     // Don`t close window, when FileRequester is open
  1133.  
  1134.                                 get(IconName, MUIA_Popasl_Active, &PopAslState);
  1135.                                 if(!PopAslState)
  1136.                                 {
  1137.                                     set(EditWindow, MUIA_Window_Open, FALSE);
  1138.                                     if(PosWindow)
  1139.                                     {
  1140.                                         CloseWindow(PosWindow);
  1141.                                         PosWindow    = NULL;
  1142.                                     }
  1143.                                     if(DrawerWindow)
  1144.                                     {
  1145.                                         CloseWindow(DrawerWindow);
  1146.                                         DrawerWindow    = NULL;
  1147.                                     }
  1148.                                     set(MainWindow, MUIA_Window_Sleep, FALSE);
  1149.  
  1150.                                         // Copy contents of gadgets to selected entry
  1151.  
  1152.                                     if(EditEntryPtr)
  1153.                                     {
  1154.                                         LONG    Dummy;
  1155.  
  1156.                                         ObtainSemaphore(&FIconSema->FIconSema);
  1157.  
  1158.                                             // Get new settings
  1159.  
  1160.                                         get(VolumeName, MUIA_String_Contents, &Dummy);
  1161.                                         NewName = stricmp(EditEntryPtr->VolName, (char *)Dummy);
  1162.                                         strcpy(EditEntryPtr->VolName, (char *)Dummy);
  1163.  
  1164.                                         get(VolumeType, MUIA_Cycle_Active, &Dummy);
  1165.                                         OldType                = EditEntryPtr->Link.ln_Type;
  1166.                                         EditEntryPtr->Link.ln_Type    = (Dummy ? LDF_DEVICES : LDF_VOLUMES);
  1167.  
  1168.                                         get(IconX, MUIA_String_Integer, &Dummy);
  1169.                                         EditEntryPtr->Left        = Dummy;
  1170.  
  1171.                                         get(IconY, MUIA_String_Integer, &Dummy);
  1172.                                         EditEntryPtr->Top        = Dummy;
  1173.  
  1174.                                         get(IconPos[(UWORD)(EditEntryPtr->Link.ln_Type == LDF_DEVICES)], MUIA_Cycle_Active, &Dummy);
  1175.                                         EditEntryPtr->IconPos    = Dummy;
  1176.  
  1177.                                         get(IconName, MUIA_String_Contents, &Dummy);
  1178.                                         strcpy(EditEntryPtr->IconName, (char *)Dummy);
  1179.  
  1180.                                         get(UseIcon[(UWORD)(EditEntryPtr->Link.ln_Type == LDF_DEVICES)], MUIA_Cycle_Active, &Dummy);
  1181.                                         EditEntryPtr->UseAlt    = Dummy;
  1182.  
  1183.                                         get(UseWindow[(UWORD)(EditEntryPtr->Link.ln_Type == LDF_DEVICES)], MUIA_Cycle_Active, &Dummy);
  1184.                                         EditEntryPtr->UseWin    = Dummy;
  1185.  
  1186.                                         get(WinX, MUIA_String_Integer, &Dummy);
  1187.                                         EditEntryPtr->WinX    = Dummy;
  1188.  
  1189.                                         get(WinY, MUIA_String_Integer, &Dummy);
  1190.                                         EditEntryPtr->WinY    = Dummy;
  1191.  
  1192.                                         get(WinWidth, MUIA_String_Integer, &Dummy);
  1193.                                         EditEntryPtr->WinWidth    = Dummy;
  1194.  
  1195.                                         get(WinHeight, MUIA_String_Integer, &Dummy);
  1196.                                         EditEntryPtr->WinHeight    = Dummy;
  1197.  
  1198.                                         get(UseFlags[(UWORD)(EditEntryPtr->Link.ln_Type == LDF_DEVICES)], MUIA_Cycle_Active, &Dummy);
  1199.                                         EditEntryPtr->UseFlags    = Dummy;
  1200.  
  1201.                                         get(FlagModes, MUIA_Cycle_Active, &Dummy);
  1202.                                         EditEntryPtr->WinFlags    = Dummy;
  1203.  
  1204.                                         if(!strstr(EditEntryPtr->IconName, ".info") && strlen(EditEntryPtr->IconName))
  1205.                                             strcat(EditEntryPtr->IconName, ".info");
  1206.  
  1207.  
  1208.  
  1209.                                             // Type of entry changed ???
  1210.  
  1211.                                         if(OldType != EditEntryPtr->Link.ln_Type)
  1212.                                         {
  1213.                                             Remove(EditEntryPtr);
  1214.  
  1215.                                             if(EditEntryPtr->Link.ln_Type == LDF_DEVICES)
  1216.                                                 AddTail(&FIconSema->VolumeList, (struct Node *)EditEntryPtr);
  1217.                                             else
  1218.                                                 AddHead(&FIconSema->VolumeList, (struct Node *)EditEntryPtr);
  1219.  
  1220.                                             DoSort    = TRUE;
  1221.                                         }
  1222.  
  1223.                                             // Name changed ???
  1224.  
  1225.                                         if(!DoSort)
  1226.                                             DoSort    = (BOOL)(NewName != 0);
  1227.  
  1228.                                             // Rearrange volume`s/device`s icon
  1229.  
  1230.                                         DskChange(EditEntryPtr);
  1231.  
  1232.                                             // Sort list
  1233.  
  1234.                                         if(DoSort)
  1235.                                         {
  1236.                                             SortList(&FIconSema->VolumeList, TRUE);
  1237.  
  1238.                                                 // Remove list
  1239.  
  1240.                                             DoMethod(UsedList, MUIM_List_Clear, NULL);
  1241.  
  1242.                                             EditEntryPtr    = (struct VolEntry *)FIconSema->VolumeList.lh_Head;
  1243.                                             while(EditEntryPtr->Link.ln_Succ)
  1244.                                             {
  1245.                                                 DoMethod(UsedList, MUIM_List_InsertSingle, (APTR)EditEntryPtr, MUIV_List_Insert_Bottom);
  1246.  
  1247.                                                 EditEntryPtr    = (struct VolEntry *)EditEntryPtr->Link.ln_Succ;
  1248.                                             }
  1249.                                         }
  1250.                                         ReleaseSemaphore(&FIconSema->FIconSema);
  1251.                                     }
  1252.                                     EditEntryPtr    = NULL;
  1253.                                 }
  1254.                                 break;
  1255.                             }
  1256.  
  1257.  
  1258.                                 // Ok (AppIcons)???
  1259.  
  1260.                             case ID_APPEDITOK :
  1261.                             {
  1262.                                 ULONG    NewName,
  1263.                                     PopAslState;
  1264.                                 BOOL    DoSort    = FALSE;
  1265.  
  1266.  
  1267.                                     // Don`t close window, when FileRequester is open
  1268.  
  1269.                                 get(AppIconName, MUIA_Popasl_Active, &PopAslState);
  1270.                                 if(!PopAslState)
  1271.                                 {
  1272.                                     set(AppEditWindow, MUIA_Window_Open, FALSE);
  1273.                                     if(PosWindow)
  1274.                                     {
  1275.                                         CloseWindow(PosWindow);
  1276.                                         PosWindow    = NULL;
  1277.                                     }
  1278.                                     if(DrawerWindow)
  1279.                                     {
  1280.                                         CloseWindow(DrawerWindow);
  1281.                                         DrawerWindow    = NULL;
  1282.                                     }
  1283.                                     set(MainWindow, MUIA_Window_Sleep, FALSE);
  1284.  
  1285.                                         // Copy contents of gadgets to selected entry
  1286.  
  1287.                                     if(EditEntryPtr)
  1288.                                     {
  1289.                                         LONG    Dummy;
  1290.  
  1291.                                         ObtainSemaphore(&FIconSema->FIconSema);
  1292.  
  1293.                                             // Get new settings
  1294.  
  1295.                                         get(AppTaskName, MUIA_String_Contents, &Dummy);
  1296.                                         NewName = stricmp(EditEntryPtr->VolName, (char *)Dummy);
  1297.                                         strcpy(EditEntryPtr->VolName, (char *)Dummy);
  1298.  
  1299.                                         EditEntryPtr->Link.ln_Type    = FICON_APPICON;
  1300.  
  1301.                                         get(AppIconX, MUIA_String_Integer, &Dummy);
  1302.                                         EditEntryPtr->Left        = Dummy;
  1303.  
  1304.                                         get(AppIconY, MUIA_String_Integer, &Dummy);
  1305.                                         EditEntryPtr->Top        = Dummy;
  1306.  
  1307.                                         get(AppIconPos, MUIA_Cycle_Active, &Dummy);
  1308.                                         EditEntryPtr->IconPos    = Dummy;
  1309.  
  1310.                                         get(AppIconName, MUIA_String_Contents, &Dummy);
  1311.                                         strcpy(EditEntryPtr->IconName, (char *)Dummy);
  1312.  
  1313.                                         get(AppUseIcon, MUIA_Cycle_Active, &Dummy);
  1314.                                         EditEntryPtr->UseAlt    = Dummy;
  1315.  
  1316.                                         if(!strstr(EditEntryPtr->IconName, ".info") && strlen(EditEntryPtr->IconName))
  1317.                                             strcat(EditEntryPtr->IconName, ".info");
  1318.  
  1319.                                             // Name changed ???
  1320.  
  1321.                                         if(!DoSort)
  1322.                                             DoSort    = (BOOL)(NewName != 0);
  1323.  
  1324.                                             // Sort list
  1325.  
  1326.                                         if(DoSort)
  1327.                                         {
  1328.                                             SortList(&FIconSema->AppIconList, TRUE);
  1329.  
  1330.                                                 // Remove list
  1331.  
  1332.                                             DoMethod(AppUsedList, MUIM_List_Clear, NULL);
  1333.  
  1334.                                             EditEntryPtr    = (struct VolEntry *)FIconSema->AppIconList.lh_Head;
  1335.                                             while(EditEntryPtr->Link.ln_Succ)
  1336.                                             {
  1337.                                                 DoMethod(AppUsedList, MUIM_List_InsertSingle, (APTR)EditEntryPtr, MUIV_List_Insert_Bottom);
  1338.  
  1339.                                                 EditEntryPtr    = (struct VolEntry *)EditEntryPtr->Link.ln_Succ;
  1340.                                             }
  1341.                                         }
  1342.                                         ReleaseSemaphore(&FIconSema->FIconSema);
  1343.                                     }
  1344.                                     EditEntryPtr    = NULL;
  1345.                                 }
  1346.                                 break;
  1347.                             }
  1348.  
  1349.                                 // Cancel (Volumes/AppIcons)???
  1350.  
  1351.                             case ID_EDITCANCEL :
  1352.                             case ID_APPEDITCANCEL :
  1353.                             {
  1354.                                 ULONG    PopAslState;
  1355.  
  1356.                                     // Don`t close window, when FileRequester is open
  1357.  
  1358.                                 get(IconName, MUIA_Popasl_Active, &PopAslState);
  1359.                                 if(!PopAslState)
  1360.                                 {
  1361.                                     set(EditWindow, MUIA_Window_Open, FALSE);
  1362.                                     set(AppEditWindow, MUIA_Window_Open, FALSE);
  1363.                                     if(PosWindow)
  1364.                                     {
  1365.                                         CloseWindow(PosWindow);
  1366.                                         PosWindow    = NULL;
  1367.                                     }
  1368.                                     if(DrawerWindow)
  1369.                                     {
  1370.                                         CloseWindow(DrawerWindow);
  1371.                                         DrawerWindow    = NULL;
  1372.                                     }
  1373.                                     set(MainWindow, MUIA_Window_Sleep, FALSE);
  1374.                                 }
  1375.                                 EditEntryPtr    = NULL;
  1376.                                 break;
  1377.                             }
  1378.  
  1379.  
  1380.  
  1381.                                 // Check man window (Volumes)
  1382.  
  1383.                             case ID_MANOK :
  1384.                             {
  1385.                                 char            *VolName;
  1386.                                 ULONG            Type;
  1387.  
  1388.                                 set(ManWindow, MUIA_Window_Open, FALSE);
  1389.                                 set(MainWindow, MUIA_Window_Sleep, FALSE);
  1390.  
  1391.  
  1392.                                 get(ManVolName, MUIA_String_Contents, &VolName);
  1393.                                 get(ManVolType, MUIA_Cycle_Active, &Type);
  1394.                                 Type    = (Type ? LDF_DEVICES : LDF_VOLUMES);
  1395.  
  1396.                                 AddNewVolume(VolName, Type, EditEntryPtr);
  1397.                                 EditEntryPtr    = NULL;
  1398.                                 break;
  1399.                             }
  1400.  
  1401.                                 // Check man window (AppIcons)
  1402.  
  1403.                             case ID_APPMANOK :
  1404.                             {
  1405.                                 char            *VolName;
  1406.  
  1407.                                 set(AppManWindow, MUIA_Window_Open, FALSE);
  1408.                                 set(MainWindow, MUIA_Window_Sleep, FALSE);
  1409.  
  1410.  
  1411.                                 get(AppManTaskName, MUIA_String_Contents, &VolName);
  1412.  
  1413.                                 AddNewVolume(VolName, FICON_APPICON, EditEntryPtr);
  1414.                                 EditEntryPtr    = NULL;
  1415.                                 break;
  1416.                             }
  1417.  
  1418.                             case ID_MANCANCEL :
  1419.                             case ID_APPMANCANCEL :
  1420.                             {
  1421.                                 set(ManWindow, MUIA_Window_Open, FALSE);
  1422.                                 set(AppManWindow, MUIA_Window_Open, FALSE);
  1423.                                 set(MainWindow, MUIA_Window_Sleep, FALSE);
  1424.                                 EditEntryPtr    = NULL;
  1425.                                 break;
  1426.                             }
  1427.                         }
  1428.  
  1429.  
  1430.                         if(GoOn && MySig)
  1431.                         {
  1432.                             if(PosWindow)
  1433.                                 MySig    |= (1 << PosWindow->UserPort->mp_SigBit);
  1434.  
  1435.                             if(DrawerWindow)
  1436.                                 MySig    |= (1 << DrawerWindow->UserPort->mp_SigBit);
  1437.  
  1438.                             MySig    = Wait(MySig | SIGBREAKF_CTRL_F);
  1439.  
  1440.  
  1441.                                 // Server snapped icon?
  1442.  
  1443.                             if(MySig & SIGBREAKF_CTRL_F)
  1444.                             {
  1445.                                 struct    VolEntry    *ThisEntry;
  1446.  
  1447.                                     // Entry being displayed?
  1448.  
  1449.                                 if(EditEntryPtr)
  1450.                                 {
  1451.                                     set(IconPos[0], MUIA_Cycle_Active, EditEntryPtr->IconPos);
  1452.                                     set(IconPos[1], MUIA_Cycle_Active, EditEntryPtr->IconPos);
  1453.                                     set(IconX, MUIA_String_Integer, EditEntryPtr->Left);
  1454.                                     set(IconX, MUIA_Disabled, (EditEntryPtr->IconPos != MODE_USE));
  1455.                                     set(IconY, MUIA_String_Integer, EditEntryPtr->Top);
  1456.                                     set(IconY, MUIA_Disabled, (EditEntryPtr->IconPos != MODE_USE));
  1457.                                     set(Position, MUIA_Cycle_Active, 0);
  1458.                                     set(Position, MUIA_Disabled, (EditEntryPtr->IconPos != MODE_USE));
  1459.  
  1460.                                     if(PosWindow)
  1461.                                         CloseWindow(PosWindow);
  1462.                                     PosWindow    = NULL;
  1463.                                 }
  1464.  
  1465.                                     // Remove entries from listview (Used)
  1466.  
  1467.                                 DoMethod(UsedList, MUIM_List_Clear, NULL);
  1468.  
  1469.                                     // Sort the list again
  1470.  
  1471.                                 SortList(&FIconSema->VolumeList, TRUE);
  1472.  
  1473.                                     // Readd list
  1474.  
  1475.                                 ThisEntry    = (struct VolEntry *)FIconSema->VolumeList.lh_Head;
  1476.                                 while(ThisEntry->Link.ln_Succ)
  1477.                                 {
  1478.                                     DoMethod(UsedList, MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  1479.  
  1480.                                     ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  1481.                                 }
  1482.                             }
  1483.  
  1484.                                 // Check for action on PosWindow
  1485.  
  1486.                             if(PosWindow && (MySig & (1 << PosWindow->UserPort->mp_SigBit)))
  1487.                             {
  1488.                                 struct    IntuiMessage    *MyMsg;
  1489.                                 ULONG            MsgClass;
  1490.                                 LONG            OldX,
  1491.                                             OldY;
  1492.  
  1493.  
  1494.                                 while((MyMsg = (struct IntuiMessage *)GetMsg(PosWindow->UserPort)))
  1495.                                 {
  1496.                                     MsgClass    = MyMsg->Class;
  1497.  
  1498.                                     ReplyMsg((struct Message *)MyMsg);
  1499.  
  1500.                                     if(MsgClass == IDCMP_CHANGEWINDOW)
  1501.                                     {
  1502.                                             // Get old position
  1503.  
  1504.                                         get(IconX, MUIA_String_Integer, &OldX);
  1505.                                         get(IconY, MUIA_String_Integer, &OldY);
  1506.  
  1507.                                         set(IconX, MUIA_String_Integer, (OldX < 0 ? PosWindow->LeftEdge - PosWindow->WScreen->Width : PosWindow->LeftEdge));
  1508.                                         set(IconY, MUIA_String_Integer, (OldY < 0 ? PosWindow->TopEdge - PosWindow->WScreen->Height : PosWindow->TopEdge));
  1509.  
  1510.                                         get(AppIconX, MUIA_String_Integer, &OldX);
  1511.                                         get(AppIconY, MUIA_String_Integer, &OldY);
  1512.  
  1513.                                         set(AppIconX, MUIA_String_Integer, (OldX < 0 ? PosWindow->LeftEdge - PosWindow->WScreen->Width : PosWindow->LeftEdge));
  1514.                                         set(AppIconY, MUIA_String_Integer, (OldY < 0 ? PosWindow->TopEdge - PosWindow->WScreen->Height : PosWindow->TopEdge));
  1515.                                     }
  1516.                                 }
  1517.                             }
  1518.  
  1519.                                 // Check for action on DrawerWindow
  1520.  
  1521.                             if(DrawerWindow && (MySig & (1 << DrawerWindow->UserPort->mp_SigBit)))
  1522.                             {
  1523.                                 struct    IntuiMessage    *MyMsg;
  1524.                                 ULONG    MsgClass;
  1525.  
  1526.                                 while((MyMsg = (struct IntuiMessage *)GetMsg(DrawerWindow->UserPort)))
  1527.                                 {
  1528.                                     MsgClass    = MyMsg->Class;
  1529.  
  1530.                                     ReplyMsg((struct Message *)MyMsg);
  1531.  
  1532.                                     if(MsgClass == IDCMP_CHANGEWINDOW)
  1533.                                     {
  1534.                                         set(WinX, MUIA_String_Integer, DrawerWindow->LeftEdge);
  1535.                                         set(WinY, MUIA_String_Integer, DrawerWindow->TopEdge);
  1536.                                         set(WinWidth, MUIA_String_Integer, DrawerWindow->Width);
  1537.                                         set(WinHeight, MUIA_String_Integer, DrawerWindow->Height);
  1538.                                     }
  1539.                                 }
  1540.                             }
  1541.                         }
  1542.                     }
  1543.  
  1544.                     if(PosWindow)
  1545.                         CloseWindow(PosWindow);
  1546.                 }
  1547.  
  1548.                 RemoveApp();
  1549.  
  1550.                     // Free BackUp lists
  1551.  
  1552.                 FreeDevVolList(&BackUpVolList);
  1553.                 FreeDevVolList(&BackUpAppList);
  1554.  
  1555.                     // Free list of available volumes
  1556.  
  1557.                 FreeDevVolList(&AvailableList);
  1558.  
  1559.                     // Free list of available applications
  1560.  
  1561.                 FreeDevVolList(&AppAvailableList);
  1562.             }
  1563.  
  1564.             RemoveFIconSema(FIconSema);
  1565.         }
  1566.     }
  1567.  
  1568.  
  1569.         // Close libs
  1570.  
  1571.     CloseAll();
  1572.  
  1573.  
  1574.         // Flush memory when requested
  1575.  
  1576.     if(FlushMemory)
  1577.     {
  1578.         APTR    FlushPtr;
  1579.         int    i;
  1580.  
  1581.         for(i = 0; i < 10; i++)
  1582.         {
  1583.             if((FlushPtr = AllocMem(0x1DCD6500, MEMF_PUBLIC)))
  1584.                 FreeMem(FlushPtr, 0x1DCD6500);
  1585.         }
  1586.     }
  1587.  
  1588.         // Send back WBStartUp Message
  1589.  
  1590.     if(WBenchMsg)
  1591.     {
  1592.         Forbid();
  1593.         ReplyMsg((struct Message *)WBenchMsg);
  1594.     }
  1595.     return(0);
  1596. }
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603. /**********************************************************************/
  1604. /*                        Functionreplacements                        */
  1605. /**********************************************************************/
  1606. void chkabort(void){;}
  1607. void __stdargs _XCEXIT(LONG Val){;}
  1608.  
  1609.  
  1610.  
  1611.  
  1612. /**********************************************************************/
  1613. /*                           Open libraries                           */
  1614. /**********************************************************************/
  1615. static BOOL OpenAll(void)
  1616. {
  1617.     if(!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 37)))
  1618.     {
  1619.         DisplayError(ERR_OPEN, (ULONG)"intuition.library", 37);
  1620.         return(FALSE);
  1621.     }
  1622.  
  1623.     if(!(MUIMasterBase = OpenLibrary("muimaster.library", 7)))
  1624.     {
  1625.         DisplayError(ERR_OPEN, (ULONG)"muimaster.library", 7);
  1626.         return(FALSE);
  1627.     }
  1628.  
  1629.     if(!(DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 37)))
  1630.     {
  1631.         DisplayError(ERR_OPEN, (ULONG)"dos.library", 37);
  1632.         return(FALSE);
  1633.     }
  1634.  
  1635.     if(!(IconBase = OpenLibrary("icon.library", 37)))
  1636.     {
  1637.         DisplayError(ERR_OPEN, (ULONG)"icon.library", 37);
  1638.         return(FALSE);
  1639.     }
  1640.  
  1641.     if(!(UtilityBase = OpenLibrary("utility.library", 37)))
  1642.     {
  1643.         DisplayError(ERR_OPEN, (ULONG)"utility.library", 37);
  1644.         return(FALSE);
  1645.     }
  1646.  
  1647.     if(!(IFFParseBase = OpenLibrary("iffparse.library", 37)))
  1648.     {
  1649.         DisplayError(ERR_OPEN, (ULONG)"iffparse.library", 37);
  1650.         return(FALSE);
  1651.     }
  1652.  
  1653.     if(!(AslBase = OpenLibrary("asl.library", 36)))
  1654.     {
  1655.         DisplayError(ERR_OPEN, (ULONG)"asl.library", 36);
  1656.         return(FALSE);
  1657.     }
  1658.  
  1659.     if(!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 37)))
  1660.     {
  1661.         DisplayError(ERR_OPEN, (ULONG)"graphics.library", 37);
  1662.         return(FALSE);
  1663.     }
  1664.  
  1665.     return(TRUE);
  1666. }
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675. /**********************************************************************/
  1676. /*                          Close libraries                           */
  1677. /**********************************************************************/
  1678. static void CloseAll(void)
  1679. {
  1680.     CloseLibrary(MUIMasterBase);
  1681.     CloseLibrary((struct Library *)GfxBase);
  1682.     CloseLibrary(AslBase);
  1683.     CloseLibrary(IFFParseBase);
  1684.     CloseLibrary(UtilityBase);
  1685.     CloseLibrary(IconBase);
  1686.     CloseLibrary((struct Library *)DOSBase);
  1687.     CloseLibrary((struct Library *)IntuitionBase);
  1688. }
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696. /**********************************************************************/
  1697. /*                         Create application                         */
  1698. /**********************************************************************/
  1699. static BOOL InitApp(void)
  1700. {
  1701.         // Init list, in case the App can not be created
  1702.  
  1703.     NewList(&AvailableList);
  1704.  
  1705.         // Create the Application window
  1706.  
  1707.     AppObject    = ApplicationObject,
  1708.                 MUIA_Application_Title,        "ForceIcon",
  1709.                 MUIA_Application_Version,    MUIVERS,
  1710.                 MUIA_Application_Copyright,    "©1993/94 Kai Iske",
  1711.                 MUIA_Application_Author,    "Kai Iske",
  1712.                 MUIA_Application_Description,    "Forces Disk.info to image/position",
  1713.                 MUIA_Application_Base,        "FIcon",
  1714.                 MUIA_Application_SingleTask,    TRUE,
  1715.                 MUIA_Application_DiskObject,    DObj    = GetDiskObjectNew("PROGDIR:ForceIcon"),
  1716.                 MUIA_HelpFile,            "ForceIcon.guide",
  1717.  
  1718.             // Now head for the main window
  1719.  
  1720.         SubWindow, MainWindow =    WindowObject,
  1721.                         MUIA_Window_Title,    "ForceIcon "REVISION" - "REVDATE,
  1722.                         MUIA_Window_ID,        'FIMW',
  1723.                         MUIA_Window_SizeGadget,    TRUE,
  1724.                         MUIA_Window_Menu,    &MainMenuDef,
  1725.                         MUIA_HelpNode,        NODE_MAIN,
  1726.  
  1727.                 // Do the gadgets
  1728.  
  1729.             WindowContents, VGroup,
  1730.  
  1731.                 Child, RegisterGroup(MainWinPageTitles),
  1732.                     MUIA_Register_Frame, TRUE,
  1733.  
  1734.  
  1735.                     Child, VGroup, // Volume group
  1736.  
  1737.                             // Columns of input
  1738.  
  1739.                         Child, ColGroup(2),
  1740.  
  1741.                                 // Create left column
  1742.  
  1743.                             Child, VGroup,
  1744.                                 MUIA_HelpNode,    NODE_LEFT,
  1745.                                 GroupFrameT("Used volumes/devices"),
  1746.  
  1747.  
  1748.                                     // Create ListView
  1749.  
  1750.                                 Child, UsedList        =    ListviewObject,
  1751.                                                     MUIA_Listview_Input,        TRUE,
  1752.                                                     MUIA_Listview_List,        ListObject, InputListFrame,
  1753.                                                         MUIA_Background,        MUII_ListBack,
  1754.                                                         MUIA_List_Format,        "COL=0",
  1755.                                                         MUIA_List_DisplayHook,        &DispViewHook,
  1756.                                                     End,
  1757.                                                 End,
  1758.  
  1759.                                 Child, EditEntry    =    TextObject, ButtonFrame,
  1760.                                                     MUIA_Text_Contents,    "Edit entry...",
  1761.                                                     MUIA_Text_PreParse,    "\33c",
  1762.                                                     MUIA_Background,    MUII_ButtonBack,
  1763.                                                     MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1764.                                                     MUIA_Text_HiChar,    'E',
  1765.                                                     MUIA_ControlChar,    'e',
  1766.                                                     MUIA_Disabled,        TRUE,
  1767.                                                 End,
  1768.  
  1769.                                 Child, CopyEntry    =    TextObject, ButtonFrame,
  1770.                                                     MUIA_Text_Contents,    "Copy entry...",
  1771.                                                     MUIA_Text_PreParse,    "\33c",
  1772.                                                     MUIA_Background,    MUII_ButtonBack,
  1773.                                                     MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1774.                                                     MUIA_Text_HiChar,    'p',
  1775.                                                     MUIA_ControlChar,    'p',
  1776.                                                     MUIA_Disabled,        TRUE,
  1777.                                                 End,
  1778.  
  1779.                                 Child, RemoveEntry    =    TextObject, ButtonFrame,
  1780.                                                     MUIA_Text_Contents,    "Remove entry",
  1781.                                                     MUIA_Text_PreParse,    "\33c",
  1782.                                                     MUIA_Background,    MUII_ButtonBack,
  1783.                                                     MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1784.                                                     MUIA_Text_HiChar,    'R',
  1785.                                                     MUIA_ControlChar,    'r',
  1786.                                                     MUIA_Disabled,        TRUE,
  1787.                                                 End,
  1788.                             End, // First column
  1789.  
  1790.  
  1791.                                 // Create right column
  1792.  
  1793.                             Child, VGroup,
  1794.                                 MUIA_HelpNode,    NODE_RIGHT,
  1795.                                 GroupFrameT("Available volumes/devices"),
  1796.  
  1797.                                     // Create ListView
  1798.  
  1799.                                 Child, AvailList    =    ListviewObject,
  1800.                                                     MUIA_Listview_Input,        TRUE,
  1801.                                                     MUIA_Listview_List,        ListObject, InputListFrame,
  1802.                                                         MUIA_Background,        MUII_ListBack,
  1803.                                                         MUIA_List_Format,        "COL=0",
  1804.                                                         MUIA_List_DisplayHook,        &DispViewHook,
  1805.                                                     End,
  1806.                                                 End,
  1807.  
  1808.                                 Child, AddEntry        =    TextObject, ButtonFrame,
  1809.                                                     MUIA_Text_Contents,    "Add entry",
  1810.                                                     MUIA_Text_PreParse,    "\33c",
  1811.                                                     MUIA_Background,    MUII_ButtonBack,
  1812.                                                     MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1813.                                                     MUIA_Text_HiChar,    'd',
  1814.                                                     MUIA_ControlChar,    'd',
  1815.                                                     MUIA_Disabled,        TRUE,
  1816.                                                 End,
  1817.  
  1818.                                 Child, AddEntryMan    =    TextObject, ButtonFrame,
  1819.                                                     MUIA_Text_Contents,    "Add manually...",
  1820.                                                     MUIA_Text_PreParse,    "\33c",
  1821.                                                     MUIA_Background,    MUII_ButtonBack,
  1822.                                                     MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1823.                                                     MUIA_Text_HiChar,    'm',
  1824.                                                     MUIA_ControlChar,    'm',
  1825.                                                 End,
  1826.  
  1827.                                 Child, RescanList    =    TextObject, ButtonFrame,
  1828.                                                     MUIA_Text_Contents,    "Rescan list",
  1829.                                                     MUIA_Text_PreParse,    "\33c",
  1830.                                                     MUIA_Background,    MUII_ButtonBack,
  1831.                                                     MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1832.                                                     MUIA_Text_HiChar,    'l',
  1833.                                                     MUIA_ControlChar,    'l',
  1834.                                                 End,
  1835.                             End, // Second column
  1836.                         End, // Columns
  1837.                     End, // Volume/Device Page
  1838.  
  1839.  
  1840.                     Child, VGroup, // AppIcon group
  1841.  
  1842.                             // Columns of input
  1843.  
  1844.                         Child, ColGroup(2),
  1845.  
  1846.                                 // Create left column
  1847.  
  1848.                             Child, VGroup,
  1849.                                 MUIA_HelpNode,    NODE_LEFT,
  1850.                                 GroupFrameT("Used applications"),
  1851.  
  1852.  
  1853.                                     // Create ListView
  1854.  
  1855.                                 Child, AppUsedList    =    ListviewObject,
  1856.                                                     MUIA_Listview_Input,        TRUE,
  1857.                                                     MUIA_Listview_List,        ListObject, InputListFrame,
  1858.                                                         MUIA_Background,        MUII_ListBack,
  1859.                                                         MUIA_List_Format,        "COL=0",
  1860.                                                         MUIA_List_DisplayHook,        &DispViewHook,
  1861.                                                     End,
  1862.                                                 End,
  1863.  
  1864.                                 Child, AppEditEntry    =    TextObject, ButtonFrame,
  1865.                                                     MUIA_Text_Contents,    "Edit entry...",
  1866.                                                     MUIA_Text_PreParse,    "\33c",
  1867.                                                     MUIA_Background,    MUII_ButtonBack,
  1868.                                                     MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1869.                                                     MUIA_Text_HiChar,    'E',
  1870.                                                     MUIA_ControlChar,    'e',
  1871.                                                     MUIA_Disabled,        TRUE,
  1872.                                                 End,
  1873.  
  1874.                                 Child, AppCopyEntry    =    TextObject, ButtonFrame,
  1875.                                                     MUIA_Text_Contents,    "Copy entry...",
  1876.                                                     MUIA_Text_PreParse,    "\33c",
  1877.                                                     MUIA_Background,    MUII_ButtonBack,
  1878.                                                     MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1879.                                                     MUIA_Text_HiChar,    'p',
  1880.                                                     MUIA_ControlChar,    'p',
  1881.                                                     MUIA_Disabled,        TRUE,
  1882.                                                 End,
  1883.  
  1884.                                 Child, AppRemoveEntry    =    TextObject, ButtonFrame,
  1885.                                                     MUIA_Text_Contents,    "Remove entry",
  1886.                                                     MUIA_Text_PreParse,    "\33c",
  1887.                                                     MUIA_Background,    MUII_ButtonBack,
  1888.                                                     MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1889.                                                     MUIA_Text_HiChar,    'R',
  1890.                                                     MUIA_ControlChar,    'r',
  1891.                                                     MUIA_Disabled,        TRUE,
  1892.                                                 End,
  1893.                             End, // First column
  1894.  
  1895.  
  1896.                                 // Create right column
  1897.  
  1898.                             Child, VGroup,
  1899.                                 MUIA_HelpNode,    NODE_RIGHT,
  1900.                                 GroupFrameT("Available applications"),
  1901.  
  1902.                                     // Create ListView
  1903.  
  1904.                                 Child, AppAvailList    =    ListviewObject,
  1905.                                                     MUIA_Listview_Input,        TRUE,
  1906.                                                     MUIA_Listview_List,        ListObject, InputListFrame,
  1907.                                                         MUIA_Background,        MUII_ListBack,
  1908.                                                         MUIA_List_Format,        "COL=0",
  1909.                                                         MUIA_List_DisplayHook,        &DispViewHook,
  1910.                                                     End,
  1911.                                                 End,
  1912.  
  1913.                                 Child, AppAddEntry    =    TextObject, ButtonFrame,
  1914.                                                     MUIA_Text_Contents,    "Add entry",
  1915.                                                     MUIA_Text_PreParse,    "\33c",
  1916.                                                     MUIA_Background,    MUII_ButtonBack,
  1917.                                                     MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1918.                                                     MUIA_Text_HiChar,    'd',
  1919.                                                     MUIA_ControlChar,    'd',
  1920.                                                     MUIA_Disabled,        TRUE,
  1921.                                                 End,
  1922.  
  1923.                                 Child, AppAddEntryMan    =    TextObject, ButtonFrame,
  1924.                                                     MUIA_Text_Contents,    "Add manually...",
  1925.                                                     MUIA_Text_PreParse,    "\33c",
  1926.                                                     MUIA_Background,    MUII_ButtonBack,
  1927.                                                     MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1928.                                                     MUIA_Text_HiChar,    'm',
  1929.                                                     MUIA_ControlChar,    'm',
  1930.                                                 End,
  1931.  
  1932.                                 Child, AppRescanList    =    TextObject, ButtonFrame,
  1933.                                                     MUIA_Text_Contents,    "Rescan list",
  1934.                                                     MUIA_Text_PreParse,    "\33c",
  1935.                                                     MUIA_Background,    MUII_ButtonBack,
  1936.                                                     MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1937.                                                     MUIA_Text_HiChar,    'l',
  1938.                                                     MUIA_ControlChar,    'l',
  1939.                                                 End,
  1940.                             End, // Second column
  1941.                         End, // Columns
  1942.                     End, // AppIcon Page
  1943.                 End, // Page group
  1944.  
  1945.  
  1946.                 Child, VSpace(1),
  1947.  
  1948.                     // Control group
  1949.  
  1950.                 Child, VGroup,
  1951.  
  1952.                         // Create control gadgets
  1953.  
  1954.                     Child, HGroup, MUIA_Group_SameWidth, TRUE,
  1955.  
  1956.                         Child, SaveObj        =    TextObject, ButtonFrame,
  1957.                                             MUIA_Text_Contents,    "Save",
  1958.                                             MUIA_Text_PreParse,    "\33c",
  1959.                                             MUIA_Background,    MUII_ButtonBack,
  1960.                                             MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1961.                                             MUIA_Text_HiChar,    'S',
  1962.                                             MUIA_ControlChar,    's',
  1963.                                         End,
  1964.  
  1965.                         Child, UseObj        =    TextObject, ButtonFrame,
  1966.                                             MUIA_Text_Contents,    "Use",
  1967.                                             MUIA_Text_PreParse,    "\33c",
  1968.                                             MUIA_Background,    MUII_ButtonBack,
  1969.                                             MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1970.                                             MUIA_Text_HiChar,    'U',
  1971.                                             MUIA_ControlChar,    'u',
  1972.                                         End,
  1973.  
  1974.                         Child, HideObj        =    TextObject, ButtonFrame,
  1975.                                             MUIA_Text_Contents,    "Cancel",
  1976.                                             MUIA_Text_PreParse,    "\33c",
  1977.                                             MUIA_Background,    MUII_ButtonBack,
  1978.                                             MUIA_InputMode,        MUIV_InputMode_RelVerify,
  1979.                                             MUIA_Text_HiChar,    'C',
  1980.                                             MUIA_ControlChar,    'c',
  1981.                                         End,
  1982.                     End, // Control panel
  1983.                 End, // Last group
  1984.             End, // window contents
  1985.         End, // Main window
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.             // Head for Editwindow
  1993.  
  1994.         SubWindow, EditWindow = WindowObject,
  1995.                         MUIA_Window_Title,    "Edit entry",
  1996.                         MUIA_Window_ID,        'FIEW',
  1997.                         MUIA_Window_SizeGadget,    TRUE,
  1998.                         MUIA_Window_NoMenus,    TRUE,
  1999.                         MUIA_HelpNode,        NODE_EDIT,
  2000.  
  2001.             WindowContents, VGroup,
  2002.  
  2003.                     // Volume group
  2004.  
  2005.                 Child, VGroup, GroupFrameT("Entry type/name"), MUIA_Group_SameWidth, TRUE,
  2006.                     Child, ColGroup(2),
  2007.                         Child, KeyLabel1("Volume", 'V'),
  2008.                         Child, VolumeName    =    StringObject, StringFrame,
  2009.                                             MUIA_String_Contents,    "",
  2010.                                             MUIA_String_MaxLen,    128,
  2011.                                             MUIA_String_Format,    MUIV_String_Format_Left,
  2012.                                             MUIA_String_BufferPos,    0,
  2013.                                             MUIA_String_Reject,    ":/",
  2014.                                             MUIA_ControlChar,    'v',
  2015.                                         End,
  2016.  
  2017.                         Child, KeyLabel1("Type", 'e'),
  2018.                         Child, VolumeType    =    KeyCycle(TypeEntries, 'e'),
  2019.                     End,
  2020.                 End, // Volume group
  2021.  
  2022.  
  2023.                 Child, ColGroup(2),
  2024.                         // Position group
  2025.  
  2026.                     Child, VGroup, GroupFrameT("Position settings"), MUIA_Group_SameWidth, TRUE,
  2027.  
  2028.                         Child, ColGroup(2),
  2029.  
  2030.                             Child, KeyLabel1("IconPos", 's'),
  2031.                             Child, IconPosGroup = PageGroup,
  2032.  
  2033.                                 Child, IconPos[0] =    CycleObject, ButtonFrame,
  2034.                                                     MUIA_Cycle_Active,    0,
  2035.                                                     MUIA_Cycle_Entries,    ModeEntriesVol,
  2036.                                                     MUIA_ControlChar,    's',
  2037.                                             End,
  2038.  
  2039.                                 Child, IconPos[1] =    CycleObject, ButtonFrame,
  2040.                                                     MUIA_Cycle_Active,    0,
  2041.                                                     MUIA_Cycle_Entries,    ModeEntriesDev,
  2042.                                                     MUIA_ControlChar,    's',
  2043.                                             End,
  2044.                             End,
  2045.  
  2046.                             Child, KeyLabel1("Current X", 'X'),
  2047.                             Child, HGroup,
  2048.                                 Child, IconX    =    StringObject, StringFrame,
  2049.                                                 MUIA_String_Contents,    "",
  2050.                                                 MUIA_String_MaxLen,    7,
  2051.                                                 MUIA_String_Format,    MUIV_String_Format_Center,
  2052.                                                 MUIA_String_BufferPos,    1,
  2053.                                                 MUIA_String_Integer,    TRUE,
  2054.                                                 MUIA_ControlChar,    'x',
  2055.                                             End,
  2056.  
  2057.                                 Child, KeyLabel1("Current Y", 'Y'),
  2058.                                 Child, IconY    =    StringObject, StringFrame,
  2059.                                                 MUIA_String_Contents,    "",
  2060.                                                 MUIA_String_MaxLen,    7,
  2061.                                                 MUIA_String_Format,    MUIV_String_Format_Center,
  2062.                                                 MUIA_String_BufferPos,    1,
  2063.                                                 MUIA_String_Integer,    TRUE,
  2064.                                                 MUIA_ControlChar,    'y',
  2065.                                             End,
  2066.                             End,
  2067.  
  2068.                             Child, KeyLabel1("Position", 'P'),
  2069.                             Child, Position    =    CycleObject, ButtonFrame,
  2070.                                                 MUIA_Cycle_Active,    0,
  2071.                                                 MUIA_Cycle_Entries,    PositionEntries,
  2072.                                                 MUIA_ControlChar,    'p',
  2073.                                         End,
  2074.                         End,
  2075.                     End, // position group
  2076.  
  2077.  
  2078.  
  2079.                         // Icon group
  2080.  
  2081.                     Child, VGroup, GroupFrameT("Icon settings"), MUIA_Group_SameWidth, TRUE,
  2082.  
  2083.                         Child, VSpace(0),
  2084.                         Child, ColGroup(2),
  2085.  
  2086.                             Child, KeyLabel1("Use Icon", 'U'),
  2087.                             Child, UseIconGroup    = PageGroup,
  2088.  
  2089.                                 Child, UseIcon[0] =    CycleObject, ButtonFrame,
  2090.                                                     MUIA_Cycle_Active,    0,
  2091.                                                     MUIA_Cycle_Entries,    ModeEntriesVol,
  2092.                                                     MUIA_ControlChar,    'u',
  2093.                                             End,
  2094.  
  2095.                                 Child, UseIcon[1] =    CycleObject, ButtonFrame,
  2096.                                                     MUIA_Cycle_Active,    0,
  2097.                                                     MUIA_Cycle_Entries,    ModeEntriesDev,
  2098.                                                     MUIA_ControlChar,    'u',
  2099.                                             End,
  2100.                             End,
  2101.  
  2102.  
  2103.                             Child, KeyLabel1("Icon", 'I'),
  2104.                             Child, IconName            = PopaslObject,
  2105.                                                 MUIA_Popstring_String,        KeyString(0, 254, 'i'),
  2106.                                                 MUIA_Popstring_Button,        PopButton(MUII_PopFile),
  2107.                                                 MUIA_Popasl_Type,        ASL_FileRequest,
  2108.                                                 ASLFR_TitleText,        "Please select an icon...",
  2109.                                             End,
  2110.                         End,
  2111.                         Child, VSpace(0),
  2112.                     End, // Icon group
  2113.                 End,
  2114.  
  2115.                     // Create window group
  2116.  
  2117.                 Child, VGroup, GroupFrameT("Window settings"), MUIA_Group_SameWidth, TRUE,
  2118.  
  2119.                     Child, ColGroup(2),
  2120.  
  2121.                         Child, KeyLabel1("Use window", 'd'),
  2122.                         Child, UseWindowGroup    = PageGroup,
  2123.  
  2124.                             Child, UseWindow[0] =    CycleObject, ButtonFrame,
  2125.                                                 MUIA_Cycle_Active,    0,
  2126.                                                 MUIA_Cycle_Entries,    ModeEntriesVol,
  2127.                                                 MUIA_ControlChar,    'd',
  2128.                                         End,
  2129.  
  2130.                             Child, UseWindow[1] =    CycleObject, ButtonFrame,
  2131.                                                 MUIA_Cycle_Active,    0,
  2132.                                                 MUIA_Cycle_Entries,    ModeEntriesDev,
  2133.                                                 MUIA_ControlChar,    'd',
  2134.                                         End,
  2135.                         End,
  2136.  
  2137.  
  2138.                         Child, KeyLabel2("Left", 'L'),
  2139.                         Child, HGroup,
  2140.                             Child, WinX    =    StringObject, StringFrame,
  2141.                                             MUIA_String_Contents,    "",
  2142.                                             MUIA_String_MaxLen,    5,
  2143.                                             MUIA_String_Format,    MUIV_String_Format_Center,
  2144.                                             MUIA_String_BufferPos,    1,
  2145.                                             MUIA_String_Integer,    TRUE,
  2146.                                             MUIA_ControlChar,    'l',
  2147.                                         End,
  2148.  
  2149.                             Child, KeyLabel1("Top", 'T'),
  2150.                             Child, WinY    =    StringObject, StringFrame,
  2151.                                             MUIA_String_Contents,    "",
  2152.                                             MUIA_String_MaxLen,    5,
  2153.                                             MUIA_String_Format,    MUIV_String_Format_Center,
  2154.                                             MUIA_String_BufferPos,    1,
  2155.                                             MUIA_String_Integer,    TRUE,
  2156.                                             MUIA_ControlChar,    't',
  2157.                                         End,
  2158.  
  2159.                             Child, KeyLabel2("Width", 'W'),
  2160.                             Child, WinWidth    =    StringObject, StringFrame,
  2161.                                             MUIA_String_Contents,    "",
  2162.                                             MUIA_String_MaxLen,    5,
  2163.                                             MUIA_String_Format,    MUIV_String_Format_Center,
  2164.                                             MUIA_String_BufferPos,    1,
  2165.                                             MUIA_String_Integer,    TRUE,
  2166.                                             MUIA_ControlChar,    'h',
  2167.                                         End,
  2168.  
  2169.                             Child, KeyLabel1("Height", 'H'),
  2170.                             Child, WinHeight =    StringObject, StringFrame,
  2171.                                             MUIA_String_Contents,    "",
  2172.                                             MUIA_String_MaxLen,    5,
  2173.                                             MUIA_String_Format,    MUIV_String_Format_Center,
  2174.                                             MUIA_String_BufferPos,    1,
  2175.                                             MUIA_String_Integer,    TRUE,
  2176.                                             MUIA_ControlChar,    'w',
  2177.                                         End,
  2178.                         End,
  2179.  
  2180.                         Child, KeyLabel1("Window", 'n'),
  2181.                         Child, LookWin =    CycleObject, ButtonFrame,
  2182.                                             MUIA_Cycle_Active,    0,
  2183.                                             MUIA_Cycle_Entries,    LookWinEntries,
  2184.                                             MUIA_ControlChar,    'n',
  2185.                                     End,
  2186.  
  2187.  
  2188.  
  2189.                         Child, KeyLabel1("Use flags", 'f'),
  2190.                         Child, UseFlagsGroup    = PageGroup,
  2191.  
  2192.                             Child, UseFlags[0] =    CycleObject, ButtonFrame,
  2193.                                                 MUIA_Cycle_Active,    0,
  2194.                                                 MUIA_Cycle_Entries,    ModeEntriesVol,
  2195.                                                 MUIA_ControlChar,    'f',
  2196.                                         End,
  2197.  
  2198.                             Child, UseFlags[1] =    CycleObject, ButtonFrame,
  2199.                                                 MUIA_Cycle_Active,    0,
  2200.                                                 MUIA_Cycle_Entries,    ModeEntriesDev,
  2201.                                                 MUIA_ControlChar,    'f',
  2202.                                         End,
  2203.                         End,
  2204.  
  2205.                         Child, KeyLabel1("Flags", 'g'),
  2206.                         Child, FlagModes    =    CycleObject, ButtonFrame,
  2207.                                             MUIA_Cycle_Active,    0,
  2208.                                             MUIA_Cycle_Entries,    FlagModesEntries,
  2209.                                             MUIA_ControlChar,    'g',
  2210.                                     End,
  2211.                     End,
  2212.                 End, // window group
  2213.  
  2214.  
  2215.  
  2216.                 Child, VSpace(1),
  2217.  
  2218.                     // Create control gadgets
  2219.  
  2220.                 Child, HGroup, MUIA_Group_SameWidth, TRUE,
  2221.  
  2222.                     Child, EditOkObj    =    TextObject, ButtonFrame,
  2223.                                         MUIA_Text_Contents,    "Ok",
  2224.                                         MUIA_Text_PreParse,    "\33c",
  2225.                                         MUIA_Background,    MUII_ButtonBack,
  2226.                                         MUIA_InputMode,        MUIV_InputMode_RelVerify,
  2227.                                         MUIA_Text_HiChar,    'O',
  2228.                                         MUIA_ControlChar,    'o',
  2229.                                     End,
  2230.  
  2231.                     Child, EditCancelObj    =    TextObject, ButtonFrame,
  2232.                                         MUIA_Text_Contents,    "Cancel",
  2233.                                         MUIA_Text_PreParse,    "\33c",
  2234.                                         MUIA_Background,    MUII_ButtonBack,
  2235.                                         MUIA_InputMode,        MUIV_InputMode_RelVerify,
  2236.                                         MUIA_Text_HiChar,    'C',
  2237.                                         MUIA_ControlChar,    'c',
  2238.                                     End,
  2239.                 End, // Control gadgets
  2240.             End, // Edit contents
  2241.         End, // AppIcon Edit window
  2242.  
  2243.  
  2244.  
  2245.  
  2246.             // Head for AppIcon Editwindow
  2247.  
  2248.         SubWindow, AppEditWindow = WindowObject,
  2249.                         MUIA_Window_Title,    "Edit entry",
  2250.                         MUIA_Window_ID,        'FIAE',
  2251.                         MUIA_Window_SizeGadget,    TRUE,
  2252.                         MUIA_Window_NoMenus,    TRUE,
  2253.                         MUIA_HelpNode,        NODE_EDIT,
  2254.  
  2255.             WindowContents, VGroup,
  2256.  
  2257.                     // Taskname group
  2258.  
  2259.                 Child, VGroup, GroupFrameT("Entry name"), MUIA_Group_SameWidth, TRUE,
  2260.                     Child, ColGroup(2),
  2261.                         Child, KeyLabel1("Task", 'T'),
  2262.                         Child, AppTaskName =    StringObject, StringFrame,
  2263.                                             MUIA_String_Contents,    "",
  2264.                                             MUIA_String_MaxLen,    128,
  2265.                                             MUIA_String_Format,    MUIV_String_Format_Left,
  2266.                                             MUIA_String_BufferPos,    0,
  2267.                                             MUIA_ControlChar,    't',
  2268.                                         End,
  2269.                     End,
  2270.                 End, // Taskname group
  2271.  
  2272.  
  2273.                 Child, ColGroup(2),
  2274.                         // Position group
  2275.  
  2276.                     Child, VGroup, GroupFrameT("Position settings"), MUIA_Group_SameWidth, TRUE,
  2277.  
  2278.                         Child, ColGroup(2),
  2279.  
  2280.                             Child, KeyLabel1("IconPos", 's'),
  2281.                             Child, AppIconPos =    CycleObject, ButtonFrame,
  2282.                                                 MUIA_Cycle_Active,    0,
  2283.                                                 MUIA_Cycle_Entries,    ModeEntriesDev,
  2284.                                                 MUIA_ControlChar,    's',
  2285.                                         End,
  2286.  
  2287.                             Child, KeyLabel1("Current X", 'X'),
  2288.                             Child, HGroup,
  2289.                                 Child, AppIconX    =    StringObject, StringFrame,
  2290.                                                 MUIA_String_Contents,    "",
  2291.                                                 MUIA_String_MaxLen,    7,
  2292.                                                 MUIA_String_Format,    MUIV_String_Format_Center,
  2293.                                                 MUIA_String_BufferPos,    1,
  2294.                                                 MUIA_String_Integer,    TRUE,
  2295.                                                 MUIA_ControlChar,    'x',
  2296.                                             End,
  2297.  
  2298.                                 Child, KeyLabel1("Current Y", 'Y'),
  2299.                                 Child, AppIconY    =    StringObject, StringFrame,
  2300.                                                 MUIA_String_Contents,    "",
  2301.                                                 MUIA_String_MaxLen,    7,
  2302.                                                 MUIA_String_Format,    MUIV_String_Format_Center,
  2303.                                                 MUIA_String_BufferPos,    1,
  2304.                                                 MUIA_String_Integer,    TRUE,
  2305.                                                 MUIA_ControlChar,    'y',
  2306.                                             End,
  2307.                             End,
  2308.  
  2309.                             Child, KeyLabel1("Position", 'P'),
  2310.                             Child, AppPosition =    CycleObject, ButtonFrame,
  2311.                                                 MUIA_Cycle_Active,    0,
  2312.                                                 MUIA_Cycle_Entries,    PositionEntries,
  2313.                                                 MUIA_ControlChar,    'p',
  2314.                                         End,
  2315.                         End,
  2316.                     End, // position group
  2317.  
  2318.  
  2319.  
  2320.                         // Icon group
  2321.  
  2322.                     Child, VGroup, GroupFrameT("Icon settings"), MUIA_Group_SameWidth, TRUE,
  2323.  
  2324.                         Child, VSpace(0),
  2325.                         Child, ColGroup(2),
  2326.  
  2327.                             Child, KeyLabel1("Use Icon", 'U'),
  2328.                             Child, AppUseIcon =    CycleObject, ButtonFrame,
  2329.                                                 MUIA_Cycle_Active,    0,
  2330.                                                 MUIA_Cycle_Entries,    ModeEntriesDev,
  2331.                                                 MUIA_ControlChar,    'u',
  2332.                                         End,
  2333.  
  2334.  
  2335.                             Child, KeyLabel1("Icon", 'I'),
  2336.                             Child, AppIconName        = PopaslObject,
  2337.                                                 MUIA_Popstring_String,        KeyString(0, 254, 'i'),
  2338.                                                 MUIA_Popstring_Button,        PopButton(MUII_PopFile),
  2339.                                                 MUIA_Popasl_Type,        ASL_FileRequest,
  2340.                                                 ASLFR_TitleText,        "Please select an icon...",
  2341.                                             End,
  2342.                         End,
  2343.                         Child, VSpace(0),
  2344.                     End, // Icon group
  2345.                 End,
  2346.  
  2347.  
  2348.                 Child, VSpace(1),
  2349.  
  2350.                     // Create control gadgets
  2351.  
  2352.                 Child, HGroup, MUIA_Group_SameWidth, TRUE,
  2353.  
  2354.                     Child, AppEditOkObj    =    TextObject, ButtonFrame,
  2355.                                         MUIA_Text_Contents,    "Ok",
  2356.                                         MUIA_Text_PreParse,    "\33c",
  2357.                                         MUIA_Background,    MUII_ButtonBack,
  2358.                                         MUIA_InputMode,        MUIV_InputMode_RelVerify,
  2359.                                         MUIA_Text_HiChar,    'O',
  2360.                                         MUIA_ControlChar,    'o',
  2361.                                     End,
  2362.  
  2363.                     Child, AppEditCancelObj    =    TextObject, ButtonFrame,
  2364.                                         MUIA_Text_Contents,    "Cancel",
  2365.                                         MUIA_Text_PreParse,    "\33c",
  2366.                                         MUIA_Background,    MUII_ButtonBack,
  2367.                                         MUIA_InputMode,        MUIV_InputMode_RelVerify,
  2368.                                         MUIA_Text_HiChar,    'C',
  2369.                                         MUIA_ControlChar,    'c',
  2370.                                     End,
  2371.                 End, // Control gadgets
  2372.             End, // Edit contents
  2373.         End, // Edit window
  2374.  
  2375.  
  2376.  
  2377.             // Head for "manually" window
  2378.  
  2379.         SubWindow, ManWindow = WindowObject,
  2380.                         MUIA_Window_Title,    "",
  2381.                         MUIA_Window_ID,        'FINW',
  2382.                         MUIA_Window_SizeGadget,    TRUE,
  2383.                         MUIA_Window_NoMenus,    TRUE,
  2384.                         MUIA_HelpNode,        NODE_MANUAL,
  2385.  
  2386.             WindowContents, VGroup,
  2387.  
  2388.                 Child, VGroup, GroupFrameT("Entry type/name"),
  2389.  
  2390.                         // String gadget
  2391.  
  2392.                     Child, ColGroup(2),
  2393.  
  2394.                         Child, KeyLabel1("Volume", 'V'),
  2395.                         Child, ManVolName    =    StringObject, StringFrame,
  2396.                                         MUIA_String_Contents,    "",
  2397.                                         MUIA_String_MaxLen,    128,
  2398.                                         MUIA_String_Format,    MUIV_String_Format_Left,
  2399.                                         MUIA_String_BufferPos,    1,
  2400.                                         MUIA_String_Reject,    ":/",
  2401.                                         MUIA_ControlChar,    'v',
  2402.                                     End,
  2403.  
  2404.                         Child, KeyLabel1("Type", 'T'),
  2405.                         Child, ManVolType    =    KeyCycle(TypeEntries, 't'),
  2406.                     End,
  2407.                 End,
  2408.  
  2409.                 Child, VSpace(1),
  2410.  
  2411.                     // Control gadgets
  2412.  
  2413.                 Child, HGroup, MUIA_Group_SameWidth, TRUE,
  2414.  
  2415.                     Child, ManOkObj    =        TextObject, ButtonFrame,
  2416.                                         MUIA_Text_Contents,    "Ok",
  2417.                                         MUIA_Text_PreParse,    "\33c",
  2418.                                         MUIA_Background,    MUII_ButtonBack,
  2419.                                         MUIA_InputMode,        MUIV_InputMode_RelVerify,
  2420.                                         MUIA_Text_HiChar,    'O',
  2421.                                         MUIA_ControlChar,    'o',
  2422.                                     End,
  2423.  
  2424.                     Child, ManCancelObj    =    TextObject, ButtonFrame,
  2425.                                         MUIA_Text_Contents,    "Cancel",
  2426.                                         MUIA_Text_PreParse,    "\33c",
  2427.                                         MUIA_Background,    MUII_ButtonBack,
  2428.                                         MUIA_InputMode,        MUIV_InputMode_RelVerify,
  2429.                                         MUIA_Text_HiChar,    'C',
  2430.                                         MUIA_ControlChar,    'c',
  2431.                                     End,
  2432.                 End, // Control gadgets
  2433.             End, // Man contents
  2434.         End, // Man window
  2435.  
  2436.  
  2437.             // Head for "manually" window (AppIcons)
  2438.  
  2439.         SubWindow, AppManWindow = WindowObject,
  2440.                         MUIA_Window_Title,    "",
  2441.                         MUIA_Window_ID,        'FINW',
  2442.                         MUIA_Window_SizeGadget,    TRUE,
  2443.                         MUIA_Window_NoMenus,    TRUE,
  2444.                         MUIA_HelpNode,        NODE_MANUAL,
  2445.  
  2446.             WindowContents, VGroup,
  2447.  
  2448.                 Child, VGroup, GroupFrameT("Entry type/name"),
  2449.  
  2450.                         // String gadget
  2451.  
  2452.                     Child, ColGroup(2),
  2453.  
  2454.                         Child, KeyLabel1("Taskname", 'T'),
  2455.                         Child, AppManTaskName    =    StringObject, StringFrame,
  2456.                                         MUIA_String_Contents,    "",
  2457.                                         MUIA_String_MaxLen,    128,
  2458.                                         MUIA_String_Format,    MUIV_String_Format_Left,
  2459.                                         MUIA_String_BufferPos,    1,
  2460.                                         MUIA_String_Reject,    ":/",
  2461.                                         MUIA_ControlChar,    't',
  2462.                                     End,
  2463.                     End,
  2464.                 End,
  2465.  
  2466.                 Child, VSpace(1),
  2467.  
  2468.                     // Control gadgets
  2469.  
  2470.                 Child, HGroup, MUIA_Group_SameWidth, TRUE,
  2471.  
  2472.                     Child, AppManOkObj    =    TextObject, ButtonFrame,
  2473.                                         MUIA_Text_Contents,    "Ok",
  2474.                                         MUIA_Text_PreParse,    "\33c",
  2475.                                         MUIA_Background,    MUII_ButtonBack,
  2476.                                         MUIA_InputMode,        MUIV_InputMode_RelVerify,
  2477.                                         MUIA_Text_HiChar,    'O',
  2478.                                         MUIA_ControlChar,    'o',
  2479.                                     End,
  2480.  
  2481.                     Child, AppManCancelObj    =    TextObject, ButtonFrame,
  2482.                                         MUIA_Text_Contents,    "Cancel",
  2483.                                         MUIA_Text_PreParse,    "\33c",
  2484.                                         MUIA_Background,    MUII_ButtonBack,
  2485.                                         MUIA_InputMode,        MUIV_InputMode_RelVerify,
  2486.                                         MUIA_Text_HiChar,    'C',
  2487.                                         MUIA_ControlChar,    'c',
  2488.                                     End,
  2489.                 End, // Control gadgets
  2490.             End, // Man contents
  2491.         End, // Man window
  2492.     End; // End application
  2493.  
  2494.         // Appobject there and got a list of available entries ???
  2495.  
  2496.     if(AppObject && GetDevVolList(&AvailableList) && GetTaskList(&AppAvailableList))
  2497.     {
  2498.         struct    VolEntry    *ThisEntry;
  2499.         int            i;
  2500.  
  2501.  
  2502.             // Main window settings
  2503.  
  2504.  
  2505.             // SetCycle chain
  2506.  
  2507.         DoMethod(MainWindow, MUIM_Window_SetCycleChain,
  2508.             UsedList,
  2509.             AvailList,
  2510.             EditEntry,
  2511.             CopyEntry,
  2512.             RemoveEntry,
  2513.             AddEntry,
  2514.             AddEntryMan,
  2515.             RescanList,
  2516.             AppUsedList,
  2517.             AppAvailList,
  2518.             AppEditEntry,
  2519.             AppCopyEntry,
  2520.             AppRemoveEntry,
  2521.             AppAddEntry,
  2522.             AppAddEntryMan,
  2523.             AppRescanList,
  2524.             SaveObj,
  2525.             UseObj,
  2526.             HideObj,
  2527.         NULL);
  2528.  
  2529.             // Set default object
  2530.  
  2531.         set(MainWindow, MUIA_Window_DefaultObject, AvailList);
  2532.  
  2533.             // Set notifications
  2534.  
  2535.         DoMethod(MainWindow, MUIM_Notify,
  2536.             MUIA_Window_CloseRequest,    TRUE,
  2537.             AppObject,            2,
  2538.             MUIM_Application_ReturnID,    ID_HIDE);
  2539.  
  2540.             // Set IDs for gadgets
  2541.  
  2542.         DoMethod(UsedList, MUIM_Notify,
  2543.             MUIA_Listview_DoubleClick,    TRUE,
  2544.             AppObject,            2,
  2545.             MUIM_Application_ReturnID,    ID_USEDLIST);
  2546.  
  2547.         DoMethod(EditEntry, MUIM_Notify,
  2548.             MUIA_Pressed,            FALSE,
  2549.             AppObject,            2,
  2550.             MUIM_Application_ReturnID,    ID_EDITENTRY);
  2551.  
  2552.         DoMethod(CopyEntry, MUIM_Notify,
  2553.             MUIA_Pressed,            FALSE,
  2554.             AppObject,            2,
  2555.             MUIM_Application_ReturnID,    ID_COPYENTRY);
  2556.  
  2557.         DoMethod(RemoveEntry, MUIM_Notify,
  2558.             MUIA_Pressed,            FALSE,
  2559.             AppObject,            2,
  2560.             MUIM_Application_ReturnID,    ID_REMOVEENTRY);
  2561.  
  2562.         DoMethod(AvailList, MUIM_Notify,
  2563.             MUIA_Listview_DoubleClick,    TRUE,
  2564.             AppObject,            2,
  2565.             MUIM_Application_ReturnID,    ID_AVAILLIST);
  2566.  
  2567.         DoMethod(AddEntry, MUIM_Notify,
  2568.             MUIA_Pressed,            FALSE,
  2569.             AppObject,            2,
  2570.             MUIM_Application_ReturnID,    ID_ADDENTRY);
  2571.  
  2572.         DoMethod(AddEntryMan, MUIM_Notify,
  2573.             MUIA_Pressed,            FALSE,
  2574.             AppObject,            2,
  2575.             MUIM_Application_ReturnID,    ID_ADDENTRYMAN);
  2576.  
  2577.         DoMethod(RescanList, MUIM_Notify,
  2578.             MUIA_Pressed,            FALSE,
  2579.             AppObject,            2,
  2580.             MUIM_Application_ReturnID,    ID_RESCANLIST);
  2581.  
  2582.         DoMethod(AppUsedList, MUIM_Notify,
  2583.             MUIA_Listview_DoubleClick,    TRUE,
  2584.             AppObject,            2,
  2585.             MUIM_Application_ReturnID,    ID_APPUSEDLIST);
  2586.  
  2587.         DoMethod(AppEditEntry, MUIM_Notify,
  2588.             MUIA_Pressed,            FALSE,
  2589.             AppObject,            2,
  2590.             MUIM_Application_ReturnID,    ID_APPEDITENTRY);
  2591.  
  2592.         DoMethod(AppCopyEntry, MUIM_Notify,
  2593.             MUIA_Pressed,            FALSE,
  2594.             AppObject,            2,
  2595.             MUIM_Application_ReturnID,    ID_APPCOPYENTRY);
  2596.  
  2597.         DoMethod(AppRemoveEntry, MUIM_Notify,
  2598.             MUIA_Pressed,            FALSE,
  2599.             AppObject,            2,
  2600.             MUIM_Application_ReturnID,    ID_APPREMOVEENTRY);
  2601.  
  2602.         DoMethod(AppAvailList, MUIM_Notify,
  2603.             MUIA_Listview_DoubleClick,    TRUE,
  2604.             AppObject,            2,
  2605.             MUIM_Application_ReturnID,    ID_APPAVAILLIST);
  2606.  
  2607.         DoMethod(AppAddEntry, MUIM_Notify,
  2608.             MUIA_Pressed,            FALSE,
  2609.             AppObject,            2,
  2610.             MUIM_Application_ReturnID,    ID_APPADDENTRY);
  2611.  
  2612.         DoMethod(AppAddEntryMan, MUIM_Notify,
  2613.             MUIA_Pressed,            FALSE,
  2614.             AppObject,            2,
  2615.             MUIM_Application_ReturnID,    ID_APPADDENTRYMAN);
  2616.  
  2617.         DoMethod(AppRescanList, MUIM_Notify,
  2618.             MUIA_Pressed,            FALSE,
  2619.             AppObject,            2,
  2620.             MUIM_Application_ReturnID,    ID_APPRESCANLIST);
  2621.  
  2622.         DoMethod(SaveObj, MUIM_Notify,
  2623.             MUIA_Pressed,            FALSE,
  2624.             AppObject,            2,
  2625.             MUIM_Application_ReturnID,    ID_SAVE);
  2626.  
  2627.         DoMethod(UseObj, MUIM_Notify,
  2628.             MUIA_Pressed,            FALSE,
  2629.             AppObject,            2,
  2630.             MUIM_Application_ReturnID,    ID_USE);
  2631.  
  2632.         DoMethod(HideObj, MUIM_Notify,
  2633.             MUIA_Pressed,            FALSE,
  2634.             AppObject,            2,
  2635.             MUIM_Application_ReturnID,    ID_HIDE);
  2636.  
  2637.             // Set disable notify-hooks
  2638.  
  2639.         DoMethod(UsedList, MUIM_Notify,
  2640.             MUIA_List_Active,        MUIV_EveryTime,
  2641.             AppObject,            3,
  2642.             MUIM_CallHook,            &DisableHook, UsedList);
  2643.  
  2644.  
  2645.         DoMethod(AvailList, MUIM_Notify,
  2646.             MUIA_List_Active,        MUIV_EveryTime,
  2647.             AppObject,            3,
  2648.             MUIM_CallHook,            &DisableHook, AvailList);
  2649.  
  2650.         DoMethod(AppUsedList, MUIM_Notify,
  2651.             MUIA_List_Active,        MUIV_EveryTime,
  2652.             AppObject,            3,
  2653.             MUIM_CallHook,            &DisableHook, AppUsedList);
  2654.  
  2655.  
  2656.         DoMethod(AppAvailList, MUIM_Notify,
  2657.             MUIA_List_Active,        MUIV_EveryTime,
  2658.             AppObject,            3,
  2659.             MUIM_CallHook,            &DisableHook, AppAvailList);
  2660.  
  2661.  
  2662.  
  2663.             // Edit window settings (Volumes)
  2664.  
  2665.             // Set cycle chain
  2666.  
  2667.         DoMethod(EditWindow, MUIM_Window_SetCycleChain,
  2668.             VolumeName,
  2669.             VolumeType,
  2670.             IconPos[0],
  2671.             IconPos[1],
  2672.             IconX,
  2673.             IconY,
  2674.             Position,
  2675.             UseIcon[0],
  2676.             UseIcon[1],
  2677.             IconName,
  2678.             UseWindow[0],
  2679.             UseWindow[1],
  2680.             WinX,
  2681.             WinY,
  2682.             WinWidth,
  2683.             WinHeight,
  2684.             UseFlags[0],
  2685.             UseFlags[1],
  2686.             FlagModes,
  2687.             EditOkObj,
  2688.             EditCancelObj,
  2689.         NULL);
  2690.  
  2691.  
  2692.             // Set notifications
  2693.  
  2694.         DoMethod(EditWindow, MUIM_Notify,
  2695.             MUIA_Window_CloseRequest,    TRUE,
  2696.             AppObject,            2,
  2697.             MUIM_Application_ReturnID,    ID_EDITCANCEL);
  2698.  
  2699.  
  2700.         DoMethod(EditOkObj, MUIM_Notify,
  2701.             MUIA_Pressed,            FALSE,
  2702.             AppObject,            2,
  2703.             MUIM_Application_ReturnID,    ID_EDITOK);
  2704.  
  2705.         DoMethod(EditCancelObj, MUIM_Notify,
  2706.             MUIA_Pressed,            FALSE,
  2707.             AppObject,            2,
  2708.             MUIM_Application_ReturnID,    ID_EDITCANCEL);
  2709.  
  2710.         DoMethod(Position, MUIM_Notify,
  2711.             MUIA_Cycle_Active,        MUIV_EveryTime,
  2712.             AppObject,            2,
  2713.             MUIM_Application_ReturnID,    ID_POSITION);
  2714.  
  2715.         DoMethod(LookWin, MUIM_Notify,
  2716.             MUIA_Cycle_Active,        MUIV_EveryTime,
  2717.             AppObject,            2,
  2718.             MUIM_Application_ReturnID,    ID_DRAWER);
  2719.  
  2720.         DoMethod(IconX, MUIM_Notify,
  2721.             MUIA_String_Acknowledge,    MUIV_EveryTime,
  2722.             AppObject,            2,
  2723.             MUIM_Application_ReturnID,    ID_ICONX);
  2724.  
  2725.         DoMethod(IconY, MUIM_Notify,
  2726.             MUIA_String_Acknowledge,    MUIV_EveryTime,
  2727.             AppObject,            2,
  2728.             MUIM_Application_ReturnID,    ID_ICONY);
  2729.  
  2730.         DoMethod(WinX, MUIM_Notify,
  2731.             MUIA_String_Acknowledge,    MUIV_EveryTime,
  2732.             AppObject,            2,
  2733.             MUIM_Application_ReturnID,    ID_WINX);
  2734.  
  2735.         DoMethod(WinY, MUIM_Notify,
  2736.             MUIA_String_Acknowledge,    MUIV_EveryTime,
  2737.             AppObject,            2,
  2738.             MUIM_Application_ReturnID,    ID_WINY);
  2739.  
  2740.         DoMethod(WinWidth, MUIM_Notify,
  2741.             MUIA_String_Acknowledge,    MUIV_EveryTime,
  2742.             AppObject,            2,
  2743.             MUIM_Application_ReturnID,    ID_WINWIDTH);
  2744.  
  2745.         DoMethod(WinHeight, MUIM_Notify,
  2746.             MUIA_String_Acknowledge,    MUIV_EveryTime,
  2747.             AppObject,            2,
  2748.             MUIM_Application_ReturnID,    ID_WINHEIGHT);
  2749.  
  2750.         DoMethod(VolumeType, MUIM_Notify,
  2751.             MUIA_Cycle_Active,        MUIV_EveryTime,
  2752.             IconPosGroup,            3,
  2753.             MUIM_Set, MUIA_Group_ActivePage, MUIV_TriggerValue);
  2754.  
  2755.         DoMethod(VolumeType, MUIM_Notify,
  2756.             MUIA_Cycle_Active,        MUIV_EveryTime,
  2757.             AppObject,            2,
  2758.             MUIM_CallHook, &PageChangeHook);
  2759.  
  2760.         DoMethod(VolumeType, MUIM_Notify,
  2761.             MUIA_Cycle_Active,        MUIV_EveryTime,
  2762.             UseIconGroup,            3,
  2763.             MUIM_Set, MUIA_Group_ActivePage, MUIV_TriggerValue);
  2764.  
  2765.         DoMethod(VolumeType, MUIM_Notify,
  2766.             MUIA_Cycle_Active,        MUIV_EveryTime,
  2767.             UseWindowGroup,            3,
  2768.             MUIM_Set, MUIA_Group_ActivePage, MUIV_TriggerValue);
  2769.  
  2770.         DoMethod(VolumeType, MUIM_Notify,
  2771.             MUIA_Cycle_Active,        MUIV_EveryTime,
  2772.             UseFlagsGroup,            3,
  2773.             MUIM_Set, MUIA_Group_ActivePage, MUIV_TriggerValue);
  2774.  
  2775.  
  2776.         for(i = 0; i < 2; i++)
  2777.         {
  2778.             DoMethod(IconPos[i], MUIM_Notify,
  2779.                 MUIA_Cycle_Active,        MUIV_EveryTime,
  2780.                 AppObject,            3,
  2781.                 MUIM_CallHook,            &DisableHook, IconPos[i]);
  2782.  
  2783.  
  2784.             DoMethod(UseIcon[i], MUIM_Notify,
  2785.                 MUIA_Cycle_Active,        MUIV_EveryTime,
  2786.                 AppObject,            3,
  2787.                 MUIM_CallHook,            &DisableHook, UseIcon[i]);
  2788.  
  2789.  
  2790.             DoMethod(UseWindow[i], MUIM_Notify,
  2791.                 MUIA_Cycle_Active,        MUIV_EveryTime,
  2792.                 AppObject,            3,
  2793.                 MUIM_CallHook,            &DisableHook, UseWindow[i]);
  2794.  
  2795.  
  2796.             DoMethod(UseFlags[i], MUIM_Notify,
  2797.                 MUIA_Cycle_Active,        MUIV_EveryTime,
  2798.                 AppObject,            3,
  2799.                 MUIM_CallHook,            &DisableHook, UseFlags[i]);
  2800.         }
  2801.  
  2802.  
  2803.  
  2804.  
  2805.             // Edit window settings (AppIcon)
  2806.  
  2807.             // Set cycle chain
  2808.  
  2809.         DoMethod(AppEditWindow, MUIM_Window_SetCycleChain,
  2810.             AppTaskName,
  2811.             AppIconPos,
  2812.             AppIconX,
  2813.             AppIconY,
  2814.             AppPosition,
  2815.             AppUseIcon,
  2816.             AppIconName,
  2817.             AppEditOkObj,
  2818.             AppEditCancelObj,
  2819.         NULL);
  2820.  
  2821.  
  2822.             // Set notifications
  2823.  
  2824.         DoMethod(AppEditWindow, MUIM_Notify,
  2825.             MUIA_Window_CloseRequest,    TRUE,
  2826.             AppObject,            2,
  2827.             MUIM_Application_ReturnID,    ID_APPEDITCANCEL);
  2828.  
  2829.         DoMethod(AppEditOkObj, MUIM_Notify,
  2830.             MUIA_Pressed,            FALSE,
  2831.             AppObject,            2,
  2832.             MUIM_Application_ReturnID,    ID_APPEDITOK);
  2833.  
  2834.         DoMethod(AppEditCancelObj, MUIM_Notify,
  2835.             MUIA_Pressed,            FALSE,
  2836.             AppObject,            2,
  2837.             MUIM_Application_ReturnID,    ID_APPEDITCANCEL);
  2838.  
  2839.         DoMethod(AppPosition, MUIM_Notify,
  2840.             MUIA_Cycle_Active,        MUIV_EveryTime,
  2841.             AppObject,            2,
  2842.             MUIM_Application_ReturnID,    ID_APPPOSITION);
  2843.  
  2844.         DoMethod(AppIconX, MUIM_Notify,
  2845.             MUIA_String_Acknowledge,    MUIV_EveryTime,
  2846.             AppObject,            2,
  2847.             MUIM_Application_ReturnID,    ID_APPICONX);
  2848.  
  2849.         DoMethod(AppIconY, MUIM_Notify,
  2850.             MUIA_String_Acknowledge,    MUIV_EveryTime,
  2851.             AppObject,            2,
  2852.             MUIM_Application_ReturnID,    ID_APPICONY);
  2853.  
  2854.         DoMethod(AppIconPos, MUIM_Notify,
  2855.             MUIA_Cycle_Active,        MUIV_EveryTime,
  2856.             AppObject,            3,
  2857.             MUIM_CallHook,            &DisableHook, AppIconPos);
  2858.  
  2859.         DoMethod(AppUseIcon, MUIM_Notify,
  2860.             MUIA_Cycle_Active,        MUIV_EveryTime,
  2861.             AppObject,            3,
  2862.             MUIM_CallHook,            &DisableHook, AppUseIcon);
  2863.  
  2864.  
  2865.  
  2866.  
  2867.  
  2868.  
  2869.             // Man window settings (Volumes)
  2870.  
  2871.             // Set cycle chaing
  2872.  
  2873.         DoMethod(ManWindow, MUIM_Window_SetCycleChain,
  2874.             ManVolName,
  2875.             ManVolType,
  2876.             ManOkObj,
  2877.             ManCancelObj,
  2878.         NULL);
  2879.  
  2880.  
  2881.             // Set notifications
  2882.  
  2883.         DoMethod(ManWindow, MUIM_Notify,
  2884.             MUIA_Window_CloseRequest,    TRUE,
  2885.             AppObject,            2,
  2886.             MUIM_Application_ReturnID,    ID_MANCANCEL);
  2887.  
  2888.  
  2889.         DoMethod(ManOkObj, MUIM_Notify,
  2890.             MUIA_Pressed,            FALSE,
  2891.             AppObject,            2,
  2892.             MUIM_Application_ReturnID,    ID_MANOK);
  2893.  
  2894.  
  2895.         DoMethod(ManCancelObj, MUIM_Notify,
  2896.             MUIA_Pressed,            FALSE,
  2897.             AppObject,            2,
  2898.             MUIM_Application_ReturnID,    ID_MANCANCEL);
  2899.  
  2900.  
  2901.  
  2902.             // Man window settings (AppIcons)
  2903.  
  2904.             // Set cycle chaing
  2905.  
  2906.         DoMethod(AppManWindow, MUIM_Window_SetCycleChain,
  2907.             AppManTaskName,
  2908.             AppManOkObj,
  2909.             AppManCancelObj,
  2910.         NULL);
  2911.  
  2912.  
  2913.             // Set notifications
  2914.  
  2915.         DoMethod(AppManWindow, MUIM_Notify,
  2916.             MUIA_Window_CloseRequest,    TRUE,
  2917.             AppObject,            2,
  2918.             MUIM_Application_ReturnID,    ID_APPMANCANCEL);
  2919.  
  2920.  
  2921.         DoMethod(AppManOkObj, MUIM_Notify,
  2922.             MUIA_Pressed,            FALSE,
  2923.             AppObject,            2,
  2924.             MUIM_Application_ReturnID,    ID_APPMANOK);
  2925.  
  2926.  
  2927.         DoMethod(AppManCancelObj, MUIM_Notify,
  2928.             MUIA_Pressed,            FALSE,
  2929.             AppObject,            2,
  2930.             MUIM_Application_ReturnID,    ID_APPMANCANCEL);
  2931.  
  2932.  
  2933.  
  2934.  
  2935.             // Add list of used entries
  2936.  
  2937.         ObtainSemaphore(&FIconSema->FIconSema);
  2938.         ThisEntry    = (struct VolEntry *)FIconSema->VolumeList.lh_Head;
  2939.  
  2940.         while(ThisEntry->Link.ln_Succ)
  2941.         {
  2942.             DoMethod(UsedList, MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  2943.  
  2944.             ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  2945.         }
  2946.         ReleaseSemaphore(&FIconSema->FIconSema);
  2947.  
  2948.  
  2949.         ObtainSemaphore(&FIconSema->FIconSema);
  2950.         ThisEntry    = (struct VolEntry *)FIconSema->AppIconList.lh_Head;
  2951.  
  2952.         while(ThisEntry->Link.ln_Succ)
  2953.         {
  2954.             DoMethod(AppUsedList, MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  2955.  
  2956.             ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  2957.         }
  2958.         ReleaseSemaphore(&FIconSema->FIconSema);
  2959.  
  2960.  
  2961.  
  2962.             // Add list of available entries
  2963.  
  2964.         ThisEntry    = (struct VolEntry *)AvailableList.lh_Head;
  2965.  
  2966.         while(ThisEntry->Link.ln_Succ)
  2967.         {
  2968.             DoMethod(AvailList, MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  2969.  
  2970.             ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  2971.         }
  2972.  
  2973.  
  2974.  
  2975.         ThisEntry    = (struct VolEntry *)AppAvailableList.lh_Head;
  2976.  
  2977.         while(ThisEntry->Link.ln_Succ)
  2978.         {
  2979.             DoMethod(AppAvailList, MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  2980.  
  2981.             ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  2982.         }
  2983.  
  2984.  
  2985.  
  2986.  
  2987.             // Open main window
  2988.  
  2989.         set(MainWindow, MUIA_Window_Open, TRUE);
  2990.     }
  2991.     else
  2992.     {
  2993.         if(MUI_Error() != MUIE_SingleTask)
  2994.             DisplayError(ERR_NO_APP, NULL);
  2995.     }
  2996.  
  2997.  
  2998.     return((BOOL)(AppObject != NULL));
  2999. }
  3000.  
  3001.  
  3002.  
  3003.  
  3004. /**********************************************************************/
  3005. /*                       Remove our application                       */
  3006. /**********************************************************************/
  3007. static void RemoveApp(void)
  3008. {
  3009.     if(AppObject)
  3010.     {
  3011.         set(MainWindow, MUIA_Window_Open, FALSE);
  3012.         MUI_DisposeObject(AppObject);
  3013.     }
  3014.  
  3015.         // Dispose DiskObject
  3016.  
  3017.     if(DObj)
  3018.         FreeDiskObject(DObj);
  3019. }
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027. /**********************************************************************/
  3028. /*                          Display function                          */
  3029. /**********************************************************************/
  3030. static ULONG    __saveds __asm DispViewFunc(register __a0 struct Hook *MyHook, register __a2 char **array, register __a1 struct VolEntry *Data)
  3031. {
  3032.     static        char    Buffer[140];
  3033.  
  3034.     if(Data->Link.ln_Type == LDF_VOLUMES)
  3035.     {
  3036.         strcpy(Buffer, "\0338");
  3037.         strcat(Buffer, Data->VolName);
  3038.     }
  3039.     else
  3040.         strcpy(Buffer, Data->VolName);
  3041.  
  3042.     *array        = Buffer;
  3043.  
  3044.     return(NULL);
  3045. }
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052. /**********************************************************************/
  3053. /*                   Hook for setting gadgetstates                    */
  3054. /**********************************************************************/
  3055. static ULONG    __saveds __asm DisableFunc(register __a0 struct Hook *MyHook, register __a2 APTR Obj, register __a1 APTR *Data)
  3056. {
  3057.     ULONG    State;
  3058.  
  3059.     if(*Data == UsedList)
  3060.     {
  3061.         get(UsedList, MUIA_List_Active, &State);
  3062.         State    = (State == MUIV_List_Active_Off ? TRUE : FALSE);
  3063.         set(EditEntry, MUIA_Disabled, State);
  3064.         set(CopyEntry, MUIA_Disabled, State);
  3065.         set(RemoveEntry, MUIA_Disabled, State);
  3066.     }
  3067.     else if(*Data == AppUsedList)
  3068.     {
  3069.         get(AppUsedList, MUIA_List_Active, &State);
  3070.         State    = (State == MUIV_List_Active_Off ? TRUE : FALSE);
  3071.         set(AppEditEntry, MUIA_Disabled, State);
  3072.         set(AppCopyEntry, MUIA_Disabled, State);
  3073.         set(AppRemoveEntry, MUIA_Disabled, State);
  3074.     }
  3075.     else if(*Data == AvailList)
  3076.     {
  3077.         get(AvailList, MUIA_List_Active, &State);
  3078.         State    = (State == MUIV_List_Active_Off ? TRUE : FALSE);
  3079.         set(AddEntry, MUIA_Disabled, State);
  3080.     }
  3081.     else if(*Data == AppAvailList)
  3082.     {
  3083.         get(AppAvailList, MUIA_List_Active, &State);
  3084.         State    = (State == MUIV_List_Active_Off ? TRUE : FALSE);
  3085.         set(AppAddEntry, MUIA_Disabled, State);
  3086.     }
  3087.     else if((*Data == IconPos[0]) || (*Data == IconPos[1]))
  3088.     {
  3089.         get(*Data, MUIA_Cycle_Active, &State);
  3090.         set(IconX, MUIA_Disabled, (State != MODE_USE));
  3091.         set(IconY, MUIA_Disabled, (State != MODE_USE));
  3092.         set(Position, MUIA_Disabled, (State != MODE_USE));
  3093.     }
  3094.     else if(*Data == AppIconPos)
  3095.     {
  3096.         get(*Data, MUIA_Cycle_Active, &State);
  3097.         set(AppIconX, MUIA_Disabled, (State != MODE_USE));
  3098.         set(AppIconY, MUIA_Disabled, (State != MODE_USE));
  3099.         set(AppPosition, MUIA_Disabled, (State != MODE_USE));
  3100.     }
  3101.     else if((*Data == UseIcon[0]) || (*Data == UseIcon[1]))
  3102.     {
  3103.         get(*Data, MUIA_Cycle_Active, &State);
  3104.         set(IconName, MUIA_Disabled, (State != MODE_USE));
  3105.     }
  3106.     else if(*Data == AppUseIcon)
  3107.     {
  3108.         get(AppUseIcon, MUIA_Cycle_Active, &State);
  3109.         set(AppIconName, MUIA_Disabled, (State != MODE_USE));
  3110.     }
  3111.     else if((*Data == UseWindow[0]) || (*Data == UseWindow[1]))
  3112.     {
  3113.         get(*Data, MUIA_Cycle_Active, &State);
  3114.         set(WinX, MUIA_Disabled, (State != MODE_USE));
  3115.         set(WinY, MUIA_Disabled, (State != MODE_USE));
  3116.         set(WinWidth, MUIA_Disabled, (State != MODE_USE));
  3117.         set(WinHeight, MUIA_Disabled, (State != MODE_USE));
  3118.         set(LookWin, MUIA_Disabled, (State != MODE_USE));
  3119.     }
  3120.     else if((*Data == UseFlags[0]) || (*Data == UseFlags[1]))
  3121.     {
  3122.         get(*Data, MUIA_Cycle_Active, &State);
  3123.         set(FlagModes, MUIA_Disabled, (State != MODE_USE));
  3124.     }
  3125.  
  3126.     return(0);
  3127. }
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134. /**********************************************************************/
  3135. /*   Change gadget states on settings of cycle gadget (VolumeType)    */
  3136. /**********************************************************************/
  3137. static ULONG    __saveds __asm PageChangeFunc(register __a0 struct Hook *MyHook, register __a2 APTR Obj, register __a1 APTR *Data)
  3138. {
  3139.     ULONG    Page;
  3140.     ULONG    State;
  3141.  
  3142.         // Get current page
  3143.  
  3144.     get(VolumeType, MUIA_Cycle_Active, &Page);
  3145.  
  3146.         // Set gadget states
  3147.  
  3148.     get(IconPos[Page], MUIA_Cycle_Active, &State);
  3149.     set(IconX, MUIA_Disabled, (State != MODE_USE));
  3150.     set(IconY, MUIA_Disabled, (State != MODE_USE));
  3151.     set(Position, MUIA_Disabled, (State != MODE_USE));
  3152.  
  3153.     get(UseIcon[Page], MUIA_Cycle_Active, &State);
  3154.     set(IconName, MUIA_Disabled, (State != MODE_USE));
  3155.  
  3156.     get(UseWindow[Page], MUIA_Cycle_Active, &State);
  3157.     set(WinX, MUIA_Disabled, (State != MODE_USE));
  3158.     set(WinY, MUIA_Disabled, (State != MODE_USE));
  3159.     set(WinWidth, MUIA_Disabled, (State != MODE_USE));
  3160.     set(WinHeight, MUIA_Disabled, (State != MODE_USE));
  3161.     set(LookWin, MUIA_Disabled, (State != MODE_USE));
  3162.  
  3163.     get(UseFlags[Page], MUIA_Cycle_Active, &State);
  3164.     set(FlagModes, MUIA_Disabled, (State != MODE_USE));
  3165.  
  3166.     return(0);
  3167. }
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180. /**********************************************************************/
  3181. /*             Add a new volumes/device to the used list              */
  3182. /**********************************************************************/
  3183. static struct VolEntry *AddNewVolume(char *Name, ULONG Type, struct VolEntry *CopyPtr)
  3184. {
  3185.     struct    List        *CheckList    = (Type == FICON_APPICON ? &FIconSema->AppIconList : &FIconSema->VolumeList);
  3186.     struct    VolEntry    *NewEntry    = NULL,
  3187.                 *ThisEntry;
  3188.  
  3189.         // Check for exitance
  3190.  
  3191.     if(CheckExists(CheckList, Name))
  3192.     {
  3193.         DisplayError(ERR_EXISTS, (ULONG)Name);
  3194.         return(NewEntry);
  3195.     }
  3196.  
  3197.         // Try to get our semaphore
  3198.  
  3199.     ObtainSemaphore(&FIconSema->FIconSema);
  3200.  
  3201.         // Get memory for new entry
  3202.  
  3203.     if((NewEntry = AllocVecPool(FIconSema, sizeof(struct VolEntry))))
  3204.     {
  3205.             // One entry plus
  3206.  
  3207.         CheckList->lh_Type++;
  3208.  
  3209.             // Add entry and fill out structure
  3210.  
  3211.         if(Type == LDF_VOLUMES)
  3212.             AddHead(CheckList, (struct Node *)NewEntry);
  3213.         else
  3214.             AddTail(CheckList, (struct Node *)NewEntry);
  3215.  
  3216.         NewEntry->Link.ln_Name    = NewEntry->VolName;
  3217.         NewEntry->Link.ln_Type    = Type;
  3218.         strcpy(NewEntry->VolName, Name);
  3219.  
  3220.             // Copy contents of other entry ???
  3221.  
  3222.         if(CopyPtr)
  3223.         {
  3224.             strcpy(NewEntry->IconName, CopyPtr->IconName);
  3225.             NewEntry->Left        = CopyPtr->Left;
  3226.             NewEntry->Top        = CopyPtr->Top;
  3227.             NewEntry->IconPos    = CopyPtr->IconPos;
  3228.             NewEntry->UseAlt    = CopyPtr->UseAlt;
  3229.             NewEntry->UseWin    = CopyPtr->UseWin;
  3230.             NewEntry->WinX        = CopyPtr->WinX;
  3231.             NewEntry->WinY        = CopyPtr->WinY;
  3232.             NewEntry->WinWidth    = CopyPtr->WinWidth;
  3233.             NewEntry->WinHeight    = CopyPtr->WinHeight;
  3234.             NewEntry->UseFlags    = CopyPtr->UseFlags;
  3235.             NewEntry->WinFlags    = CopyPtr->WinFlags;
  3236.         }
  3237.  
  3238.             // Remove entries from listview (Used)
  3239.  
  3240.         DoMethod((Type == FICON_APPICON ? AppUsedList : UsedList), MUIM_List_Clear, NULL);
  3241.  
  3242.             // Sort the list again
  3243.  
  3244.         SortList(CheckList, TRUE);
  3245.  
  3246.             // Readd list
  3247.  
  3248.         ThisEntry    = (struct VolEntry *)CheckList->lh_Head;
  3249.         while(ThisEntry->Link.ln_Succ)
  3250.         {
  3251.             DoMethod((Type == FICON_APPICON ? AppUsedList : UsedList), MUIM_List_InsertSingle, (APTR)ThisEntry, MUIV_List_Insert_Bottom);
  3252.  
  3253.             ThisEntry    = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  3254.         }
  3255.     }
  3256.     else
  3257.     {
  3258.         DisplayError(ERR_NOMEM, NULL);
  3259.         NewEntry    = NULL;
  3260.     }
  3261.  
  3262.         // Free our semaphore
  3263.  
  3264.     ReleaseSemaphore(&FIconSema->FIconSema);
  3265.  
  3266.     return(NewEntry);
  3267. }
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276. /**********************************************************************/
  3277. /*        Check for existance of a volume within the user list        */
  3278. /**********************************************************************/
  3279. static BOOL CheckExists(struct List *CheckList, char *Name)
  3280. {
  3281.     BOOL    RetVal = FALSE;
  3282.  
  3283.     ObtainSemaphore(&FIconSema->FIconSema);
  3284.  
  3285.     if(!IsListEmpty(CheckList))
  3286.     {
  3287.         struct    VolEntry    *ThisEntry    = (struct VolEntry *)CheckList->lh_Head;
  3288.  
  3289.         do
  3290.         {
  3291.             if(!stricmp(ThisEntry->VolName, Name))
  3292.                 RetVal = TRUE;
  3293.  
  3294.             ThisEntry = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  3295.         } while(!RetVal && ThisEntry->Link.ln_Succ);
  3296.     }
  3297.  
  3298.     ReleaseSemaphore(&FIconSema->FIconSema);
  3299.  
  3300.     return(RetVal);
  3301. }
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309. /**********************************************************************/
  3310. /*                       Save Prefs to disk/env                       */
  3311. /**********************************************************************/
  3312. static BOOL            DoSavePrefs(char *PrefsName);
  3313. static BOOL SavePrefs(BOOL EnvMode, char *ToName)
  3314. {
  3315.     if(ToName)
  3316.         return(DoSavePrefs(ToName));
  3317.  
  3318.     else
  3319.     {
  3320.             // On ENV: mode, simply save to ENV: only
  3321.  
  3322.         if(DoSavePrefs("ENV:ForceIcon_prefs.iff"))
  3323.         {
  3324.                 // Otherwise write to envarc: as well
  3325.  
  3326.             if(!EnvMode)
  3327.                 return(DoSavePrefs("ENVARC:ForceIcon_prefs.iff"));
  3328.             else
  3329.                 return(TRUE);
  3330.         }
  3331.     }
  3332.     return(FALSE);
  3333. }
  3334. static BOOL DoSavePrefs(char *PrefsName)
  3335. {
  3336.     struct    IFFHandle    *PrefsHandle;
  3337.     LONG    Error;
  3338.     BOOL    GoOn = FALSE;
  3339.     UWORD    VersChunk[] =
  3340.     {
  3341.         VERNUM,
  3342.         REVNUM
  3343.     };
  3344.  
  3345.  
  3346.     ObtainSemaphore(&FIconSema->FIconSema);
  3347.  
  3348.         // Get handle for IFF
  3349.  
  3350.     if((PrefsHandle = AllocIFF()))
  3351.     {
  3352.             // Open file for save
  3353.  
  3354.         if((PrefsHandle->iff_Stream = Open(PrefsName, MODE_NEWFILE)))
  3355.         {
  3356.                 // Init Handle
  3357.  
  3358.             InitIFFasDOS(PrefsHandle);
  3359.  
  3360.                 // Open Handle
  3361.  
  3362.             if(!(Error = OpenIFF(PrefsHandle, IFFF_WRITE)))
  3363.             {
  3364.                     // Write FORM chunk
  3365.  
  3366.                 if(!(Error = PushChunk(PrefsHandle, 'FOIC', 'FORM', IFFSIZE_UNKNOWN)))
  3367.                 {
  3368.                         // Write version chunk
  3369.  
  3370.                     if(!(Error = PushChunk(PrefsHandle, 'FOIC', 'VERS', IFFSIZE_UNKNOWN)))
  3371.                     {
  3372.                         if((Error = WriteChunkBytes(PrefsHandle, &VersChunk[0], (sizeof(UWORD) * 2))) == (sizeof(UWORD) * 2))
  3373.                             Error = PopChunk(PrefsHandle);
  3374.                         else
  3375.                             Error = IoErr();
  3376.                     }
  3377.  
  3378.                         // Write Prefs chunk
  3379.  
  3380.                     if(!Error && !(Error = PushChunk(PrefsHandle, 'FOIC', 'PREF', IFFSIZE_UNKNOWN)))
  3381.                     {
  3382.                         struct    VolEntry    *ThisEntry;
  3383.                         UWORD    NumEntriesVol            = FIconSema->VolumeList.lh_Type,
  3384.                             NumEntriesApp            = FIconSema->AppIconList.lh_Type,
  3385.                             NumEntries            = NumEntriesVol + NumEntriesApp;
  3386.                         BOOL    NoErr = TRUE;
  3387.  
  3388.                                 // Write all entries of volume list
  3389.  
  3390.                         if((Error = WriteChunkBytes(PrefsHandle, &NumEntries, sizeof(UWORD))) == sizeof(UWORD))
  3391.                         {
  3392.                             ThisEntry    = (struct VolEntry *)FIconSema->VolumeList.lh_Head;
  3393.  
  3394.                                 // Write list of volumes
  3395.  
  3396.                             while(NumEntriesVol-- && NoErr)
  3397.                             {
  3398.                                 UWORD    EntryType = ThisEntry->Link.ln_Type;
  3399.  
  3400.                                 if((Error = WriteChunkBytes(PrefsHandle, &EntryType, sizeof(UWORD))) == sizeof(UWORD))
  3401.                                 {
  3402.                                     if((Error = WriteChunkBytes(PrefsHandle, &ThisEntry->VolName, 130)) == 130)
  3403.                                     {
  3404.                                         if((Error = WriteChunkBytes(PrefsHandle, &ThisEntry->IconName, 256)) == 256)
  3405.                                         {
  3406.                                             if((Error = WriteChunkBytes(PrefsHandle, &ThisEntry->Left, (sizeof(UWORD) * 36))) != (sizeof(UWORD) * 36))
  3407.                                                 NoErr = FALSE;
  3408.                                         }
  3409.                                     }
  3410.                                 }
  3411.  
  3412.                                 ThisEntry = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  3413.                             }
  3414.  
  3415.                                 // Write list of AppIcons
  3416.  
  3417.                             ThisEntry    = (struct VolEntry *)FIconSema->AppIconList.lh_Head;
  3418.                             while(NumEntriesApp-- && NoErr)
  3419.                             {
  3420.                                 UWORD    EntryType = ThisEntry->Link.ln_Type;
  3421.  
  3422.                                 if((Error = WriteChunkBytes(PrefsHandle, &EntryType, sizeof(UWORD))) == sizeof(UWORD))
  3423.                                 {
  3424.                                     if((Error = WriteChunkBytes(PrefsHandle, &ThisEntry->VolName, 130)) == 130)
  3425.                                     {
  3426.                                         if((Error = WriteChunkBytes(PrefsHandle, &ThisEntry->IconName, 256)) == 256)
  3427.                                         {
  3428.                                             if((Error = WriteChunkBytes(PrefsHandle, &ThisEntry->Left, (sizeof(UWORD) * 36))) != (sizeof(UWORD) * 36))
  3429.                                                 NoErr = FALSE;
  3430.                                         }
  3431.                                     }
  3432.                                 }
  3433.  
  3434.                                 ThisEntry = (struct VolEntry *)ThisEntry->Link.ln_Succ;
  3435.                             }
  3436.  
  3437.                             if(NoErr)
  3438.                             {
  3439.                                 if(!(Error = PopChunk(PrefsHandle)))
  3440.                                     GoOn = TRUE;
  3441.                             }
  3442.                         }
  3443.                     }
  3444.                 }
  3445.  
  3446.                 if((Error = PopChunk(PrefsHandle)))
  3447.                     GoOn = FALSE;
  3448.  
  3449.                 CloseIFF(PrefsHandle);
  3450.             }
  3451.  
  3452.             Close(PrefsHandle->iff_Stream);
  3453.         }
  3454.         else
  3455.             Error = IoErr();
  3456.  
  3457.         FreeIFF(PrefsHandle);
  3458.     }
  3459.     else
  3460.         Error = ERR_NOMEM;
  3461.  
  3462.     if(!GoOn)
  3463.         DisplayError(Error, (ULONG)PrefsName);
  3464.  
  3465.     ReleaseSemaphore(&FIconSema->FIconSema);
  3466.  
  3467.     return(GoOn);
  3468. }
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474. /**********************************************************************/
  3475. /*                  Make a specific entry diskchange                  */
  3476. /**********************************************************************/
  3477. static void DskChange(struct VolEntry *ListEntry)
  3478. {
  3479.     struct    List    ChangeList;
  3480.  
  3481.     NewList(&ChangeList);
  3482.  
  3483.  
  3484.         // Create list of connected devices
  3485.  
  3486.     if(GetDosEntries(&ChangeList, LDF_VOLUMES))
  3487.     {
  3488.         struct    DosList        *DList;
  3489.         struct    VolEntry    *ThisEntry;
  3490.         struct    DevProc        *DevProc;
  3491.         char            DevName[130];
  3492.         BOOL            FoundDev,
  3493.                     DoDskCh;
  3494.  
  3495.             // Loop for all volumes in list
  3496.  
  3497.         while((ThisEntry = (struct VolEntry *)RemHead(&ChangeList)))
  3498.         {
  3499.             FoundDev    = FALSE;
  3500.  
  3501.                 // Find name of device this volume resides in
  3502.  
  3503.             if((DList = LockDosList(LDF_DEVICES|LDF_READ)))
  3504.             {
  3505.                 while((DList = NextDosEntry(DList, LDF_DEVICES|LDF_READ)))
  3506.                 {
  3507.                     if(ThisEntry->DriverTask == DList->dol_Task)
  3508.                     {
  3509.                         setmem(DevName, 130, 0);
  3510.                         strncpy(DevName, ((char *)BADDR(DList->dol_Name) + 1), *((char *)BADDR(DList->dol_Name)));
  3511.                         FoundDev    = TRUE;
  3512.                     }
  3513.                 }
  3514.                 UnLockDosList(LDF_DEVICES|LDF_READ);
  3515.             }
  3516.  
  3517.                 // Found corresponding device ???
  3518.  
  3519.             if(FoundDev)
  3520.             {
  3521.                     // Check whether to diskchange
  3522.  
  3523.                 if(ListEntry->Link.ln_Type == LDF_DEVICES)
  3524.                     DoDskCh    = (MyStrCmp(ListEntry->VolName, DevName) == 0);
  3525.                 else
  3526.                     DoDskCh    = (MyStrCmp(ListEntry->VolName, ThisEntry->VolName) == 0);
  3527.  
  3528.                     // Diskchange device ???
  3529.  
  3530.                 if(DoDskCh)
  3531.                 {
  3532.                     strcat(DevName, ":");
  3533.  
  3534.                     if(ThisEntry->DriverTask && (DevProc = GetDeviceProc(DevName, NULL)))
  3535.                     {
  3536.                         if(TypeOfMem(DevProc->dvp_Port))
  3537.                         {
  3538.                             if(DoPkt(DevProc->dvp_Port, ACTION_INHIBIT, DOSTRUE, NULL, NULL, NULL, NULL))
  3539.                                 DoPkt(DevProc->dvp_Port, ACTION_INHIBIT, DOSFALSE, NULL, NULL, NULL, NULL);
  3540.                         }
  3541.                         FreeDeviceProc(DevProc);
  3542.                     }
  3543.                 }
  3544.             }
  3545.  
  3546.             FreeVecPool(FIconSema, ThisEntry);
  3547.         }
  3548.     }
  3549. }
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556. /**********************************************************************/
  3557. /*                 Get a list of all available tasks                  */
  3558. /**********************************************************************/
  3559. static BOOL AddTaskEntry(struct Task *NewTask)
  3560. {
  3561.     struct    Process        *NewProc    = (struct Process *)NewTask;
  3562.     struct    VolEntry    *NewEntry;
  3563.     char            *TaskName    = NewTask->tc_Node.ln_Name,
  3564.                 Buffer[132];
  3565.     UWORD            NameLen        = strlen(TaskName);
  3566.  
  3567.  
  3568.         // Task a process?
  3569.  
  3570.     if(NewTask->tc_Node.ln_Type == NT_PROCESS && NewProc->pr_CLI)
  3571.     {
  3572.         struct    CommandLineInterface    *CLI = BADDR(NewProc->pr_CLI);
  3573.  
  3574.         if(CLI->cli_Module && CLI->cli_CommandName)
  3575.         {
  3576.             char    *Dummy    = BADDR(CLI->cli_CommandName);
  3577.  
  3578.             NameLen        = *Dummy++;
  3579.             TaskName    = Dummy;
  3580.         }
  3581.     }
  3582.  
  3583.     setmem(Buffer, 132, 0);
  3584.     strncpy(Buffer, TaskName, (NameLen >= 130 ? 130 : NameLen));
  3585.  
  3586.     if((NewEntry = AllocVecPool(FIconSema, sizeof(struct VolEntry))))
  3587.     {
  3588.         AddTail(&AppAvailableList, (struct Node *)NewEntry);
  3589.  
  3590.         strcpy(NewEntry->VolName, Buffer);
  3591.  
  3592.         NewEntry->Link.ln_Name        = NewEntry->VolName;
  3593.         NewEntry->Link.ln_Type        = FICON_APPICON;
  3594.  
  3595.         AppAvailableList.lh_Type++;
  3596.  
  3597.         return(TRUE);
  3598.     }
  3599.     return(FALSE);
  3600. }
  3601. static BOOL GetTaskList(struct List *AppList)
  3602. {
  3603.     struct    Task    *SelectTask;
  3604.     BOOL        Failed;
  3605.  
  3606.     NewList(AppList);
  3607.  
  3608.     Forbid();
  3609.  
  3610.         // Add my task
  3611.  
  3612.     Failed    = !AddTaskEntry(SysBase->ThisTask);
  3613.  
  3614.         // Add ready tasks
  3615.  
  3616.     if(!Failed && !IsListEmpty(&SysBase->TaskReady))
  3617.     {
  3618.         SelectTask    = (struct Task *)SysBase->TaskReady.lh_Head;
  3619.  
  3620.         while(SelectTask->tc_Node.ln_Succ && !Failed)
  3621.         {
  3622.             Failed        = !AddTaskEntry(SelectTask);
  3623.  
  3624.             SelectTask    = (struct Task *)SelectTask->tc_Node.ln_Succ;
  3625.         }
  3626.     }
  3627.  
  3628.         // Add waiting tasks
  3629.  
  3630.     if(!Failed && !IsListEmpty(&SysBase->TaskWait))
  3631.     {
  3632.         SelectTask    = (struct Task *)SysBase->TaskWait.lh_Head;
  3633.  
  3634.         while(SelectTask->tc_Node.ln_Succ && !Failed)
  3635.         {
  3636.             Failed        = !AddTaskEntry(SelectTask);
  3637.  
  3638.             SelectTask    = (struct Task *)SelectTask->tc_Node.ln_Succ;
  3639.         }
  3640.     }
  3641.  
  3642.     Permit();
  3643.  
  3644.         // Sort list
  3645.  
  3646.     SortList(AppList, TRUE);
  3647.  
  3648.         // Indicate failure
  3649.  
  3650.     return((BOOL)(!Failed));
  3651. }
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657. /**********************************************************************/
  3658. /*                          Query a filename                          */
  3659. /**********************************************************************/
  3660. static BOOL GetFileName(struct Window *Window, char *Title, char *FileName, ULONG Flags1)
  3661. {
  3662.     struct    Rectangle    ScrRec;
  3663.     struct    FileRequester    *FileReq;
  3664.     char            Drawer[514],
  3665.                 File[514];
  3666.     UWORD            Left,
  3667.                 Top,
  3668.                 Width,
  3669.                 Height;
  3670.     BOOL            Result    = FALSE;
  3671.  
  3672.  
  3673.     if(QueryOverscan(GetVPModeID(&Window->WScreen->ViewPort), &ScrRec, OSCAN_TEXT))
  3674.     {
  3675.         Width    = ((ScrRec.MaxX - ScrRec.MinX + 1) * 45) / 100;
  3676.         Height    = ((ScrRec.MaxY - ScrRec.MinY + 1) * 8) / 10;
  3677.         Left    = (((ScrRec.MaxX + 1) - Width) >> 1) - Window->WScreen->LeftEdge;
  3678.         Top    = (((ScrRec.MaxY + 1) - Height) >> 1) - Window->WScreen->TopEdge;
  3679.  
  3680.             // Get Patch of filename
  3681.  
  3682.         setmem(Drawer, 514, 0);
  3683.         if((char *)PathPart(FileName) != (char *)&FileName[0])
  3684.         {
  3685.             strncpy(Drawer, FileName, (PathPart(FileName) - FileName));
  3686.         }
  3687.  
  3688.             // Get Filename
  3689.  
  3690.         strcpy(File, FilePart(FileName));
  3691.  
  3692.             // Set up pattern
  3693.  
  3694.         if((FileReq = AllocAslRequestTags(ASL_FileRequest,
  3695.             ASLFR_Screen,        Window->WScreen,
  3696.             ASLFR_Window,        Window,
  3697.             ASLFR_PrivateIDCMP,    TRUE,
  3698.             ASLFR_SleepWindow,     TRUE,
  3699.             ASLFR_TitleText,    Title,
  3700.             ASLFR_InitialDrawer,    (ULONG)Drawer,
  3701.             ASLFR_InitialFile,    (ULONG)File,
  3702.             ASLFR_InitialLeftEdge,    Left,
  3703.             ASLFR_InitialTopEdge,    Top,
  3704.             ASLFR_InitialWidth,    Width,
  3705.             ASLFR_InitialHeight,    Height,
  3706.             ASLFR_Flags1,        Flags1,
  3707.             ASLFR_Flags2,        FRF_REJECTICONS,
  3708.         TAG_DONE)))
  3709.         {
  3710.             if(AslRequest(FileReq, NULL) && (strlen(FileReq->fr_File)))
  3711.             {
  3712.                     // Create filetypes again
  3713.  
  3714.                 strcpy(FileName, "");
  3715.  
  3716.                 AddPart(FileName, FileReq->fr_Drawer, 512);
  3717.                 AddPart(FileName, FileReq->fr_File, 512);
  3718.                 Result = TRUE;
  3719.             }
  3720.  
  3721.             FreeAslRequest(FileReq);
  3722.         }
  3723.     }
  3724.  
  3725.     return(Result);
  3726. }
  3727.  
  3728.  
  3729.  
  3730.  
  3731. /**********************************************************************/
  3732. /*                    Clone the contents of a list                    */
  3733. /**********************************************************************/
  3734. static BOOL CloneList(struct List *ToList, struct List *FromList)
  3735. {
  3736.     struct    VolEntry    *FromEntry,
  3737.                 *ToEntry;
  3738.     BOOL            Result        = TRUE;
  3739.  
  3740.     NewList(ToList);
  3741.  
  3742.     FromEntry    = (struct VolEntry *)FromList->lh_Head;
  3743.     ToList->lh_Type    = FromList->lh_Type;
  3744.  
  3745.     while(FromEntry->Link.ln_Succ && Result)
  3746.     {
  3747.         if((ToEntry = AllocVecPool(FIconSema, sizeof(struct VolEntry))))
  3748.         {
  3749.             *ToEntry        = *FromEntry;
  3750.  
  3751.             ToEntry->Link.ln_Name    = ToEntry->VolName;
  3752.  
  3753.             AddTail(ToList, (struct Node *)ToEntry);
  3754.         }
  3755.         else
  3756.             Result    = FALSE;
  3757.  
  3758.         FromEntry    = (struct VolEntry *)FromEntry->Link.ln_Succ;
  3759.     }
  3760.  
  3761.     if(!Result)
  3762.     {
  3763.         FreeDevVolList(ToList);
  3764.         DisplayError(ERR_NOMEM, NULL);
  3765.     }
  3766.  
  3767.     return(Result);
  3768. }
  3769.  
  3770.  
  3771.  
  3772.  
  3773. /**********************************************************************/
  3774. /*       Now include the LoadRoutine and the VolumeList routine       */
  3775. /**********************************************************************/
  3776. #include    "LoadPrefs.h"
  3777. #include    "VolList.h"
  3778. #include    "Error.h"
  3779. #include    "Rendezvous.h"
  3780. #include    "CheckToolTypes.h"
  3781. #include    "PoolVec.h"
  3782.